### Author Topic: How to set UpVector of camera?  (Read 1999 times)

#### jumong

• byte
• Posts: 19
##### How to set UpVector of camera?
« 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!!!
« Last Edit: September 01, 2010, 04:38:13 pm by jumong »

#### raft

• Posts: 1984
##### Re: How to set UpVector of camera?
« Reply #1 on: September 01, 2010, 05:10:01 pm »
is this what you are looking for ?
Camera.setOrientation(direction, upVector)

#### jumong

• byte
• Posts: 19
##### Re: How to set UpVector of camera?
« Reply #2 on: September 01, 2010, 05:15:38 pm »
In this function, what is meaning of direction, I don't know well...
It seems  simpleVector of lookAt function?
« Last Edit: September 01, 2010, 05:21:16 pm by jumong »

#### raft

• Posts: 1984
##### Re: How to set UpVector of camera?
« Reply #3 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.

#### jumong

• byte
• Posts: 19
##### Re: How to set UpVector of camera?
« Reply #4 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?

#### raft

• Posts: 1984
##### Re: How to set UpVector of camera?
« Reply #5 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.

#### paulscode

• double
• Posts: 863
##### Re: How to set UpVector of camera?
« Reply #6 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.