www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: jumong on September 01, 2010, 04:35:24 pm

Title: How to set UpVector of camera?
Post by: jumong on September 01, 2010, 04:35:24 pm
hi,
I am developing simple program using camera, but here, I don't know how to set UpVector of camera
Help!!!
Title: Re: How to set UpVector of camera?
Post by: raft on September 01, 2010, 05:10:01 pm
is this what you are looking for ?
Camera.setOrientation(direction, upVector) (http://www.jpct.net/jpct-ae/download/alpha/doc/com/threed/jpct/Camera.html#setOrientation(com.threed.jpct.SimpleVector, com.threed.jpct.SimpleVector))
Title: Re: How to set UpVector of camera?
Post by: jumong on September 01, 2010, 05:15:38 pm
thank you for your help
In this function, what is meaning of direction, I don't know well...
It seems  simpleVector of lookAt function?
Title: Re: How to set UpVector of camera?
Post by: raft on September 01, 2010, 05:21:04 pm
it's the direction the camera should look into. you can place camera in infinite ways looking into same direction. upVector picks an orientation among these where up direction in camera space is the given upVector.
Title: Re: How to set UpVector of camera?
Post by: jumong on September 01, 2010, 05:28:47 pm
I did like follow
camera.setOrientation(vecCameraTarget, new SimpleVector(0,0,1));

then, all Object in screen disappeared
What am I doing wrong?
Title: Re: How to set UpVector of camera?
Post by: raft on September 01, 2010, 06:34:28 pm
in jPCT's coordinate system typical upVector is (0, -1, 0)
and the result also depends on where your objects and camera are in the scene.
Title: Re: How to set UpVector of camera?
Post by: paulscode on September 01, 2010, 08:08:05 pm
Also, make sure your vecCameraTarget vector is normalized, and also make sure that it forms a right-angle with whatever up-vector you use.