1. Member
Join Date
Feb 2010
Posts
10
Rep Power
0

## 3d trigonometry

i am trying to figure out how to move a camera around in jogl. the function to set the camera takes the arguments 0f x position,y position,z position, x coordinates to look at, y coordinates to look at, and z coordinates to look at. if i know the x and y angles that my camera is at, how i calculate the change in x, y, and z coordinates, and which coordinates to look at?

2. Originally Posted by deepthought
i am trying to figure out how to move a camera around in jogl. the function to set the camera takes the arguments 0f x position,y position,z position, x coordinates to look at, y coordinates to look at, and z coordinates to look at. if i know the x and y angles that my camera is at, how i calculate the change in x, y, and z coordinates, and which coordinates to look at?
Let (xc, yx, zc) be the location of the camera and let (xt, yt, xt) be the target position (where the camera is looking at). Translate over position T, so the camera is at position (xc-xt, yt-yc, zc-zt) and looking at (0, 0, 0) (the origin). You can rotate this new point however you want (and find new x, y, z, coordinates for the camera). When you're done translate the new coordinates back over position T (see above). Google is your friend w.r.t. 3D rotation matrixes.

kind regards,

Jos

3. Member
Join Date
Feb 2010
Posts
10
Rep Power
0
sorry man, but that's right over my head. the look at function takes (posx,posy,posz) as where the camera is,(lookx,looky,lookz) as where you're looking at, and(headx,heady,headz) as where the top of the head is pointing. how do i use this function if i know (x position,y position, zposition,yaw,pitch,roll) ? please send code because i have no idea how to implement it myself.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•