Results 1 to 3 of 3

Thread: 3d trigonometry

  1. #1
    deepthought is offline Member
    Join Date
    Feb 2010
    Posts
    10
    Rep Power
    0

    Default 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?
    Jocks rule the highschools, but GEEKS RULE THE WORLD MWAHAHAHA!!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by deepthought View Post
    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. #3
    deepthought is offline Member
    Join Date
    Feb 2010
    Posts
    10
    Rep Power
    0

    Default

    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.
    Jocks rule the highschools, but GEEKS RULE THE WORLD MWAHAHAHA!!

Posting Permissions

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