Author Topic: a question about camera.lookat()  (Read 4160 times)

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
a question about camera.lookat()
« on: January 11, 2007, 08:50:25 pm »
camera.lookat()  at an object,  it will put the object in the center of the screen.  Can the camera look at the object but the object is not in the center, ie, in the left or right part of the screen. notice that the object will keep on moving.

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
a question about camera.lookat()
« Reply #1 on: January 11, 2007, 09:40:34 pm »
once its facing, in the center of the screen, perhaps you can rotate the camera manually to put it off center.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
a question about camera.lookat()
« Reply #2 on: January 11, 2007, 10:08:59 pm »
Thanks for the reply.

Can I get the rotate angle of the camera comparied with the init position?

The problem is that how I know the angle's value?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
a question about camera.lookat()
« Reply #3 on: January 11, 2007, 11:06:53 pm »
You can get the camera's rotation matrix (you may have to invert it depending on your needs) and derive the rotation angles from this like here: http://www.jpct.net/forum/viewtopic.php?t=576
However, this code is untested yet...at least by me. May work, may not...

Offline halcor

  • byte
  • *
  • Posts: 28
    • View Profile
a question about camera.lookat()
« Reply #4 on: January 12, 2007, 03:43:05 pm »
Maybe you can parent an empty object to the object of interest and then camera.lookAt() that empty object. For example, place an empty between the eyes of a head of a human mesh, parent the empty to the mesh and camera.lookAt() the empty - you get camera tracking on the eyes :)