Hi,
I want to rotate an object about a pivot point.
Basically I want to set a point based on which the object needs to be rotated.
But,
node->setRotation rotates an object which is not expected.
Please let me know how to do it.
regards,
Kguru
Pivot point for 3D rotation
Code: Select all
ISceneNode* pivot; // the object youre pivoting around
ISceneNode* object; // the object youre moving
vector3df pos(0, 0, 100); // starting point, pre-rotation. determines distance from pivot.
matrix4 m;
m.setRotationDegrees(vector3df(12,34,56)); // the desired rotation around the pivot
m.rotateVect(pos);
object->setPosition(pivot->getAbsolutePosition() + pos); // (or, if object is a child of pivot, just setPosition(pos)