View more

View more

View more

Image of the Day Submit

IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Rotating to a vector

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

#1CaffeinePwrdAl  Members

Posted 14 October 2001 - 09:04 AM

i need to rotate an object to be so it is aligned with the normal of a plane. ie from this...

plane          Object

_|__
\             |    |
\            |____|
\
\


to this...

plane    _  Object
-  \/
\     \   \
\     \_-
\
\


Obviously i know the normal of the plane, but i cant figure out how to rotate the object so that the object is lying on the plane. ( im using opengl by the way, if it helps) its probably staring me in the face and waving a union jack, but i''m short sighted.

#2Scarab0  Members

Posted 14 October 2001 - 09:32 AM

Basically what you want to do is this:
1. Create a rotation matrix that rotates the object''s Up-vector onto the plane''s normal-vector.
2. Rotate the entire object by that matrix

I assume that you know how to do step 2, and step 1 is a common programming problem. Here''s one site that explains how to do it, but there surely are many more: http://www.doe-mbi.ucla.edu/~grothe/rotmat/rotmat.html

Hope that helped.

#3CaffeinePwrdAl  Members

Posted 14 October 2001 - 10:26 AM

whoa it cant be that hard can it, that site confused the hell out of me. isnt there a way using dot products or something im sure i saw something i just cant remember it.

+ do you have an implementation of that, i dont want to rip code from people, but maybe you could direct me to some pseudo code or something ?

if you could it would be great, i look into this a bit more as well. i like doing things on my own, not the newbie - "rip code from any where and every where, whack it all in one file and pass it off as my own pile of s**t". it just means they achieve nothing. (point of view came from my own experience, i was like that, just had to re learn everything cos i never learnt it properly)

---------------------------------------------------------------

back to the problem...

im also sure i saw some ting like this,
    normal = A      rotation matrix =  A  B  C            B                         x  x  x            C                         x  x  x

cant for the life of me remember what the x''s were or even if any of that means anything i may just be getting confused. help

I dont know.

"why dont you work you f*#@&\$g piece of junk!"

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.