Car rotation stuck

So i made a car follow a track from this example.
In my code i wanted 2 things:

  1. speed is framerate independent
  2. the car is allowed to have movement offset from the track ( the car doesn’t have to follow the track 100%).

It worked until i tried to smooth the rotation. The car gets stuck between the segments 26 and 27.
And it rotates back and forth, this doesn’t happen when there is no interpolation.
https://playground.babylonjs.com/#4MM2TV#2

I have no clue why this is happening, the relevant code is between 175 and 205.
Maybe someone knows what is causing this?

Also i want to ask why all playground examples don’t use deltaTime when moving objects.
In gameEngines this is default to keep the movement framerate independent.
So i am confused why the examples don’t use it.

All help is greatly appreciated

Hi @Xradiation and welcome to the forum.

Playground examples are personal to the writer and they may just have particular techniques they want to exemplify and not complicate by adding others.

Lot of code going on here to unpick. Also when using a closed track with Path3D the start and end normals can be in opposite directions which can cause problem.

You can check out a more complex way of dealing with tracks at

1 Like