Results 1 to 4 of 4

Thread: 3D Rotation trouble

  1. #1

    Thread Starter
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking 3D Rotation trouble

    Hey, i thought this was best suited to maths... cos 3D graphics is always maths...
    anyway

    I have a camera in a 3D world. I don't use quaternions to represent it (i know, bad...) but instead have its position (one point in space) and its rotation (another point, {x,y,z} representing the x-, y-, and z- rotation.

    Now, moving in direction facing, and strafing is easy, as it involves movement of the position point. However, how would it be possible to rotate the camera say {l,m,n} degrees WITH RESPECT to the current viewing angle of {a,b,c} degrees? This is for doing things such as turning left, looking up, and then doing both at the same time.

    Unfortunately you can't just put new rotation to be {a+l,b+m,c+n}, not to use a simple matrix multiplication, as the point is really a rotation, not a point as such.

    Just wondering, is it possible say to make a mock unit vector pointing in the default direction (up = +ve y axis, forwards = +ve z axis) then rotate that and use its new position to help find the rotation needed??
    sql_lall

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    its similar to the case where you rotate about an arbitrary point, then you would have T1 R T2 where you translate to origo, then rotate and translate back to the point. If the object coordinate system is rotated as well, then you just add it up the pile T1 R1 R R2 T2 where R2 is the rotation in respect to world coordinates and R1 is the negative rotation.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    and if you want to move on to quaternions, heres a tutorial:
    http://www.gamedev.net/reference/pro...rs/default.asp
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking right...

    yeah, i have some stuff about Quat. anyway (useful, cos its in book form), just that i was using a certain way to handle meshes, and implemented the same sort of idea with a camera.

    Anyway...

    Is it really possible to just transform a set of 3 rotations like that, and get what you need??

    for instance, say you wanted to turn left and look up, the rotation wanted would be approx {-45,45,0}. However, if the camera's rotation is at {12,-56,120}, then u can use this to transform the {-45,45,0} point, then add the X/Y/Z values? Ok. Just that it seemed wrong, as i would have thought multiplying the matrices in a different order would have changed the result, even though it should be possible to choose any order....
    sql_lall

Posting Permissions

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



Click Here to Expand Forum to Full Width