Vehicle steering controller

Hi,

I’m trying to customize TestFancyCar, I want that car follows a path in a certain time. I’ve implented a PhysicsController:





else if (getRepeatType() == RT_WRAP) {

deltaTime = (currentTime - getMinTime()) % 1.0f;

if (deltaTime > 1) {

currentTime = 0;

deltaTime = 0;

}

Vector3f direction=new Vector3f(mover.getLocalTranslation());

Vector3f direction2=new Vector3f(curve.getPoint(deltaTime,mover.getLocalTranslation()));



direction2=(direction2.subtractLocal(direction));



mover.accelerate(-10);

float steering=-(float) Math.atan(direction2.z/direction2.x);

mover.steer(steering);



} …





Vehicle doesn’t behave as expected.

Is it the right approach to do it?

Thanks in advance

bye