A couple of changes for Godot 4, if any one is struggling. -Spatial nodes are now Node3D -On the script: export (float,1,10,0.1) var smooth_speed = 2.5 should now be: @export_range (1,10,0.1) var smooth_speed: float = 2.5
@60south30
Жыл бұрын
tanks
@misterdanielyoung
Жыл бұрын
thank you kind stranger
@SykeAE
5 ай бұрын
Thank you so much
@IGORESTD
7 ай бұрын
EM PORTUGUES BRASILEIRO!!! Muito obrigado pelo tutorial, estou a uma semana aprendendo a movimentação da câmera junto ao carro e só com seu tutorial pude conseguir o q estava imaginado! IN INGLES Thank you very much for the tutorial, I've been learning how to move the camera next to the car for a week and only with your tutorial was I able to achieve what I imagined!
@eversonmay
Жыл бұрын
extends Spatial var direction = Vector3.FORWARD export (float,1 ,10,0.1) var smooth_speed = 2.5 func _physics_process(delta): var current_velocity = get_parent().get_linear_velocity() current_velocity.y = 0 if current_velocity.length_squared() > 1: direction = lerp(direction, -current_velocity.normalized(),smooth_speed*delta) global_transform.basis = get_rotation_from_direction(direction) func get_rotation_from_direction(look_direction : Vector3) -> Basis: look_direction = look_direction.normalized() var x_axis = look_direction.cross(Vector3.UP) return Basis(x_axis,Vector3.UP, -look_direction)
@lionlight9514
Жыл бұрын
Thanks
@RileyNiko
7 ай бұрын
my only issue with this is that the camera turns around whenever I go in reverse; I'm trying to make an arcade racing game like mariokart, where backing up is rare and only used if you bonk something, so the camera ALWAYS faces forward. is there a simple or at least understandable way to make that work?
@djawadjustme2328
2 жыл бұрын
Please , Make More Tutorials Like Drift System Of Cars.
@EmeraldChickn
Жыл бұрын
The only thing I had to adjust to get it working in godot 4 was line 4 to @export_range(1, 10, 0.1) var smooth_speed : float Thanks a lot for the tutorial though mate! :)
@Raventiger2
Жыл бұрын
could you please do something on car bodies like the one you had in the start of part one of the godot car
@JayGames-n5t
10 ай бұрын
I've watched the car video but I have a problem I want to make the car go faster so it can be more arcade But when I reverse I reverse to fast and the car flips over How can I fix it
@SRCoder
10 ай бұрын
Read the pinned comment at the top of the comments section for the reverse speed fix. The other problem is simply a test of how much you understood when doing the video. If you understand what's happening its easy to do.
@NameMeTommy
2 жыл бұрын
Your tutorial helped me a lot! Im struggling at adding a sound to the car.. Could you please help me? Thank you :) Edit : Got it. For anyone who have the same struggle here is my complete code for it (includes steering codes etc...) You have to add audiostreamplayer as a child of the "car" (vehicle body) extends VehicleBody func _physics_process(delta): steering = Input.get_axis("right","left") * 0.4 engine_force = Input.get_axis("backward","forward") * 100 if Input.is_action_just_pressed("forward"): $AudioStreamPlayer.play() if Input.is_action_just_released("forward"): $AudioStreamPlayer.stop() If it doesnt work reply me and i will gladly help u with it :)
@ManLikeMustiYT
Жыл бұрын
when i use it the sound does not loop
@NameMeTommy
Жыл бұрын
@@ManLikeMustiYT you just probably didnt turn on "repeat" on soundstream node, i think it should work after that 👍
@ManLikeMustiYT
Жыл бұрын
@@NameMeTommy Yes but it is greyed out and stuck on disabled
@ManLikeMustiYT
Жыл бұрын
nvm i fixed it. Thank you though!
@NameMeTommy
Жыл бұрын
@@ManLikeMustiYT umm well thats kinda odd.. Im currently at school but once ill get home ill take a look into my project for you and let you know where the issue
@uint8_Tao
2 жыл бұрын
I figured out if we going back and forth in a straight line, the camera don't really like it, so I normalized the direction during the lerp and it smooth it out. And changed the condition to test the speed to 0.1 to get rid of the remaining aberrations during being still. if currunt_velocity.length() > 0.1: direction = lerp(direction.normalized(), -currunt_velocity.normalized(), smooth_speed * delta)
@bananaman9869
Ай бұрын
Thank you that helped a lot!
@TheInfamousLegend27
Жыл бұрын
honestly this car series has been really helpful. i tried multiple approaches for making vehicles and camera systems, and none of them really felt right but this lil series has topped it for me and the game i want to make. thank you so much for your contributions to the godot community! i definitely can't be the only one you've helped in such a way but i felt a personal thanks was in order :)
@SRCoder
Жыл бұрын
Thanks!
@JohnStonexDj
5 күн бұрын
You are a God! It works 100%
@FrancoisSchnell
2 жыл бұрын
Really cool, thanks for sharing :)
@sandakureva
Жыл бұрын
The only problem I'm running into is that the camera will swing around if you hit something hard enough. That's one I'm going to need to tinker with to fix.
@Rest_Ramzi
Жыл бұрын
i cannot enderstant this script
@JohnnyCashOriginal
Жыл бұрын
Great video. Thanks for sharing your knowledge. Would you consider in the future doing a video on how to add engine sound effects based on speed of the car for example?
@SRCoder
Жыл бұрын
Well you have the rpm of the wheels, so I reckon just set the audiostreamplayers pitch_scale to some function of the rpm and you'll have what you are after. Experimenting is part of the fun!
@foobars3816
2 жыл бұрын
I really wish you had explained the math a bit and added reasoning for each step. Without that this is pretty much just copying and pasting things without any real understanding.
@SRCoder
2 жыл бұрын
Yeah. Sorry. It's a bit complicated so I just got people to copy. It's just a way to stop the wheels accelerating to infinity by applying a function of the rpm and the motor torque.
@foobars3816
2 жыл бұрын
@@SRCoder I think you are talking about the other video. The one about rpm was pretty understandable, but this chase camera one has me quite lost. Unfortunately the Godot docs are also quite lacking when it comes to explaining things such as linear_velocity, normalized, global_transform.basis. I'm guessing the docs assume knowledge of linear algebra... of which I have zero. Cross product and velocity and linear transformations were acutally pretty easy to Google, but the rest is still stumping me and I'm not sure if I know what linear velocity means. Some general statements about why you are adding each line and what it achieves would be great as well as a pointer to other videos to learn more. But I get it's a lot more work so many not be worth it for you. I also noticed the final chase cam doesn't work as well as the one in your demo video, especially when reversing. In the original demo (on other videos) the camera rotates around the car to the front when the player starts reversing, however in this code the camera points away from the car.
@foobars3816
2 жыл бұрын
@@SRCoder Side note, your videos are also better than ones I've seen on other channels, so thank you! My comments are meerly suggestions that I believe would make them even better. I am grateful for what you have provided as I actually have a working car that drives around and a camera that follows it, which is amazing!
@foobars3816
2 жыл бұрын
@@SRCoder Sorry I had actually miss an important part at 0:52. I missed that the piviot should have been on the car and the 3D Point offset from that. My mistake clicked after a while, when I thought about why it was called a piviot :blush:. The camera works perfectly after I fixed this. I'm still not sure how it works, but at least it does.
@TheNathy1000
Жыл бұрын
extends Spatial var direction = Vector3.FORWARD export (float,1.10,0.1) var smooth_speed = 2.5 func _physics_process(delta): var current_velocity = get_parent().get_linear_velocity() current_velocity.y = 0 if current_velocity.length_squared() > 1: direction = lerp(direction, -current_velocity.normalized(), smooth_speed*delta) global_transform.basis = get_rotation_from_direction(direction) func get_rotation_from_direction(look_direction : Vector3) -> Basis: look_direction = look_direction.normalized() var x_axis = look_direction.cross(Vector3.UP) return Basis(x_axis, Vector3.UP, - look_direction)
@djawadjustme2328
2 жыл бұрын
Thank You So Much ~!
@loudris442
Жыл бұрын
Can you do a drifting tutorial?
@The10ie
2 жыл бұрын
this is awesome, really helped me
@jlebrech
2 жыл бұрын
how do you have entering and exiting the car?
@mohammadmahmudhasan4050
2 жыл бұрын
In the previous tutorial you teached how to create a car controller for a car. I did everything you did. I did not use any type of other collision object other than the ground to let the car collide with. But the car is suddenly jumping acting like it's colliding with something in front of it and sometimes flipping over. What do you think I did wrong?
@SRCoder
2 жыл бұрын
Not sure. Check the wheels are not colliding with the actual car body. Move them outside or below that collider to make sure
@foobars3816
2 жыл бұрын
@@SRCoder I had the exact same thought. It sounds like the wheels interacting with the body.
@Андрей-я3ж3ч
2 жыл бұрын
Tell me please. How i can make acceleration effect? In nfs pro street you can see this effect. When car is accelerate, camera changes the viewing angle. it's not the distance of the camera from the car when accelerating. This is precisely the change in the camera angle. for example, the standard values are 200 degrees, and when the car accelerates, the degree increases and it seems as if the car is accelerating effect
@SRCoder
2 жыл бұрын
Just change the cameras field of view based on speed.
@ansettaustralia
11 ай бұрын
something like $camera.set_fov(70 + car_current_velocity * 1.1)
@msajidsarker
2 жыл бұрын
Accelerating backwards causes high acceleration and reversing speed compared to accelerating forwards.
@SRCoder
2 жыл бұрын
Yeah. You need to get the rpm as an absolute value abs() for the equation to work. I can't believe I missed that!
@msajidsarker
2 жыл бұрын
@@SRCoder 😊
@raymonddurelli8610
2 жыл бұрын
Aloha, loved the first tutorial but I am having trouble with this one. Godot says I can not lerp a Vector3. I also see no spatial node (using godot 4) so I used a Node3d.
@SRCoder
2 жыл бұрын
I honestly haven't tried this in Godot 4 so I'm not going to be much help. We'll done for getting that far. Keep looking through the docs as the best place for help. Good luck!
@raymonddurelli8610
2 жыл бұрын
@@SRCoder Understandable. If you have the time I'd love to see Godot 4 tutorials. It's only alpha but it's such a change I felt like it's worth making the leap early.
@beastnighttv
Жыл бұрын
I also have the same issue, using Godot 4.0 Stable Mono (I am using C#)
@beastnighttv
Жыл бұрын
fixed it by direction.Lerp(-CurrentVelocity.Normalized(), (float)(2.5 * delta));
@bnkm07
2 жыл бұрын
hi I am sorry about my disrespectful behavior last time I am here to make things right and would like to know how to make this car be able to drift
@LilSesh
Жыл бұрын
Literally tried this multiple times followed to the T and cannot make it work. Not even slightly close.
@HieromonkRazov
Жыл бұрын
Dear! Sound and tire tracks are more important(needed) than cameras))
Пікірлер: 57