3rd person camera + bullet physics


I’m trying to program a simple race game therefore i’m modifying the fancy car demo.

I want to create a camera that follows the car in a certain distance, well you know

race games :).

I have tried using the ChaseCamera but the chase camera does only turn behind the vehicle if it does not steer right or left.

Then I have implemented my own version using the difference between two consecutive positions as vehicle direction, but the vehicle ‘quivers’ and so the camera does too.

Are there any ideas how to get the vehicle calm or better ways creating a 3rd person camera?

Thanks in advance.

I’ve used the method below for my game, works nicely.

To have delayed rotation use:

private float slerpSpeed = .05f;

private float distance= 10.0f;


cam.setLocation(vehicleNode.getLocalTranslation().add(cam.getRotation().mult(new Vector3f(0,0,distance))));


private float distance= 10.0f;


cam.setLocation(vehicleNode.getLocalTranslation().add(cam.getRotation().mult(new Vector3f(0,0,distance))));

Thank you,

the delayed rotation was another problem I had :). But the shivering of the car transfers to the camera and then the camera is shivering. I think the shivering comes from the suspension, so I tinkered a little with the values but I couldn’t eliminiate the shivering completely. Maybe I should implement some kind of filter but this leads to a jerk when accelerating from 0 km/h. While driving the shivering is not appreciable so it only applies while standing.

Any good values for the suspension?

Thanks in advance

I added the delay/slerp to get rid of shivering on my camera, the vehicle it chases is built up of hingejoints and multiple rigidbodies so the shivering/shaking is substantial. Try lowering the slerpSpeed and see if it helps, or try adding interpolation to the distance as well.

float distInterpolateSpeed = 0.01f;

cam.getLocation().interpolate(vehicleNode.getLocation().add(cam.getRotation().mult(new Vector3f(0,0,distance))),distInterpolateSpeed);

Lowering the slerpspeed for the camera rotation did the trick for me.It seems that I will have to make it dependend on the tpf, but I will find a good compromise between shivering and too slow rotation.

Interpolating the camera position leads to unwanted side effects, but I don’t need it anyway.

Thanks a lot

Yeah sorry, forgot about tpf, it’s in my own code as well. Glad it worked:)