Godot Version
4.2.1
Question
I’m making a racing game and I want the car to rotate to match the ground. I used a Raycast to detect the ground’s normal and then apply it to the car’s rotation, and it seemed like it worked, but it goes by kind of chunks. I don’t know how to explain it, here’s a video of what happens:
(please ignore the sound in the video)
Also, this is the code I used: car_mesh.rotation.x = raycast.get_collision_normal().z
To make it smoother I then used lerp: car_mesh.rotation.x = lerp(car_mesh.rotation.x, raycast.get_collision_normal().z, delta * 3)
But it still goes by chunks.
My theory is that the raycast is not detecting the ground’s normal all the time, but I’m not sure. Any idea?