www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Zlobnyi Serg on September 15, 2004, 03:50:06 pm

Title: Camera rotation - which way is easiest?
Post by: Zlobnyi Serg on September 15, 2004, 03:50:06 pm
I need to rotate camera around some point (camera.lookAt(somepoint)) in worldspace. Is there embedded routines to implement this action, or which way is easiest to rotate camera around?

Thank you!
Title: Camera rotation - which way is easiest?
Post by: EgonOlsen on September 15, 2004, 05:00:12 pm
One way is to place the camera at "somepoint", do the rotation and move the camera backwards. Something like

Code: [Select]
camera.setPosition(somepoint);
camera.rotateCameraY(0.1f);
camera.moveCamera(Camera.CAMERA_MOVEOUT, 20f);
camera.lookAt(somepoint); //Maybe not needed in this case...depends on the application


Another solution would be to create a dummy object that rotates around "somepoint" and set the camera to its position every frame. In this case, the lookAt() is definitely needed.