Author Topic: Camera rotation - which way is easiest?  (Read 3588 times)

Zlobnyi Serg

  • Guest
Camera rotation - which way is easiest?
« 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!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Camera rotation - which way is easiest?
« Reply #1 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.