Camera Positioning

Hi, I'm new to JME so sorry in advance for any silly mistakes.



I have a 3D basic game up and running with a sky box, fog, terrain and a model loaded from a file.



What I'm trying to do is place the camera directly over the model.

I have tried doing it like this: (Note: Because the model is moving I have placed this code in the update method)

cam.getLocation().set(model.getLocalTranslation());
cam.getLocation().addLocal(new Vector3f(0, 10, 0);
cam.lookAt(model.getLocalTranslation(), Vector3f.UNIT_Y);


And it work with one exception, as the model moves the camera slowly rotates upwards.

Could anyone guide me on how to fix this problem, or perhaps point me to some good information about camera positioning.

Thanks

PS nice smiley :D

Well if you just want the camera overhead the player and looking down, all you need to do is:



1 - Initialize the camera with its direction pointing down (ie use lookAt())

2 - Update only the camera's location + your Y-offset



You don't need to use the cam LookAt() for every update, unless of course you want a camera that's a bit fancier, like in in the ChaseCamera class.