Racing AI car wobbles when following the spline

Hey I’ve been trying to make a car racing game. I’ve implemented the AI car which drives through the spline. But it wobbles and not going straight even when the spline is straight.
Could somebody please help me with this? I’ve attached the script of AI car steering through the spline.

Hey @Rishi_Jayanthan. My theory is that the weird movement is due to the way you are calculating the position of the car in each tick. You are trying to predict the next position along the spline by taking the current velocity and approximating the position along the spline for the next tick, which is possibly not always correct, hence the wobbling.

Here is a short video on how to take advantage of the spline component. A spline is made to animate an object moving along its curve, so it is not necessary to manually calculate and try to approximate the position of the actor you are trying to move, the spline already has functions that allow you to know the exact position of your actor, given a distance along the spline.

I’m sure you can find more videos like this one if you are interested. Those videos will probably explain the concept better than I could in a short answer here.

Hope this helps!

yeah but I think we can achieve more than just moving an object along its curve using spline.
My AI car drives through it and also steer when necessary by finding the nearest tangent and turn according to that. But it wobbles due to car speed. If the Speed is less, everything works fine. But I need to make it work even in high speed.