• Advertisement
Sign in to follow this  

Placement of player on top of world mesh

This topic is 3249 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody, My problem is as follows: Given initial orientation and normal vectors and target orientation and normal vectors, I want to be able to transform the initial vectors to the target vectors. Assume that the orientation and normal vectors are orthogonal. My current, non working, solution's pseduo-code: 1. Let N,O be the initial normal and orientation vectors respectivly, Let N',O' be the TARGET normal and orientation vectors respectivly. 2. NormalRotationAxis = CrossProduct(N,N') 3. Normalize(NormalRotationAxis) 4. AngleBetweenNormals = GetAngle(N,N') 5. targetN = Rotate N AngleBetweenNormals degress about NormalRotationAxis axis 6. newOrientation = Rotate O AngleBetweenNormals degress about NormalRotationAxis axis 7. AngleBetweenOrientations = GetAngle(newOrientation,O') 8. targetO = Rotate newOrientation AngleBetweenOrientations degrees about targetN. At the end of this code targetN = N' but targetO != O'. I can't figure out why. As you can see, i'm taking a 2 step approach. First Match normals, then find out how much to rotate about the matched normal or match the orientations. Is this approach wrong? Is there an easier approach? If there's nothing wrong with this i'll post a more detailed implementation. Thanks! Y.

Share this post


Link to post
Share on other sites
Advertisement
If i understand correctly u wanna
rotate one vector to another vector (thus u want a rotation matrix that describes this)
see here Q 39/40
http://www.j3d.org/matrix_faq/matrfaq_latest.html

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement