www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: qjvictor on January 11, 2007, 08:50:25 pm

Title: a question about camera.lookat()
Post by: qjvictor 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.
Title: a question about camera.lookat()
Post by: cyberkilla 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.
Title: a question about camera.lookat()
Post by: qjvictor 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?
Title: a question about camera.lookat()
Post by: EgonOlsen 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...
Title: a question about camera.lookat()
Post by: halcor 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 :)