setting the camera in 3d racing game

Hello

I am working on a simple 3d race game, i am using KeyNavigatorBehavior to move the car and I would need to have the car in the middle of the screen (just like in every race game) but I dont really know how to do it, could anyone help me out ?

regards, Lukasz

This post should help you out.

http://www.java-gaming.org/forums/index.php?topic=2523.0

I don´t really understand your problem. The way you have implemented the controls doesn´t really have anything to do with the camera. If you have an object that moves, regardless what is causing the movement the camera must move at the same speed in order to achieve the camera that is used in all racing games.

You´ll need to set the Transform3D of the camera to match that of the car, and then move it back a little (depending on how close you want your camera to follow it).

Conzar : thanks, will look at that

Mr. Gol : use of KeyNavigatorBehavior was just a general information. I tried a lot to get me unstuck however nothing worked for me. Yes, I do somehow need to connect my camera with the car unfortunatelly I dont have a clue how to do it. I ran a thread that sets camera’s transform but its not being updated much enough so I achieved a funny effect as if the camera was chasing me :slight_smile: I would try to update camera’s position in my own Behavior class if I didn’t use KeyNavigatorBehavior, which I dont know how to modify :frowning:

why don’t you implement something like a scenenode tree? Then you can make a parent scenenode to where you can attach both the camera and the car. You can then make it so that if you move the parent node, it automatically moves all of the parents children aswell.