How to rotate using Pivot point?
Hello! I am wondering how to rotate a 3D object in a 3D world. I am
using OpenGL and reading the object's Pivot point(x,y,z) from .3ds
file.
I should probably first translate the coordinates with some matrix
math from world coordinates(that 3ds studio max uses) into object
coordinates(that i'm using with openGL), or do you have some better
ideas?
How do I use the Pivot point and the rotation data(I succesfully read
100 keyframes for this rotation track) to rotate the object
succesfully in my 3d world?
thank you in advance.. Best wishes, teemu turkki
Hey,
I believe what you want to do is first translate the object to the origin by the pivot point P(-x,-y,-z) then rotate the object, then translate it back to its pivot point.
// Note matrix math works from right to left.
FinalTransform = TransPiv * Rotation * TransOrigin
I believe what you want to do is first translate the object to the origin by the pivot point P(-x,-y,-z) then rotate the object, then translate it back to its pivot point.
// Note matrix math works from right to left.
FinalTransform = TransPiv * Rotation * TransOrigin
Quote:Original post by ph33r
Hey,
I believe what you want to do is first translate the object to the origin by the pivot point P(-x,-y,-z) then rotate the object, then translate it back to its pivot point.
// Note matrix math works from right to left.
FinalTransform = TransPiv * Rotation * TransOrigin
Exactly correct. To rotate about a point P, you need to perform:
V' = T(P) * R * T(-P) * V
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement