Hello,
well, possibly for you easy to answer, in spite of me:
I want to let meshes rotate around a specified centre, which will be defined (another mesh, e.g.)and will have to change this centre point sometimes.
Also I should have to define the radius and the angle of the rotation.
Is there any pre-defined action in irrlicht to do that?
Rotation around specified centre
The fastest way is to subtract the point that represents the center of rotation from the position of the node. Then, do normal rotation and then add back the position of the rotation point. For example :
Note: you may have to call setInverseRotationDegrees, instead of setRotationDegrees.
I don't know what you mean by radius. What does the radius have to do with rotation? I guess, the radius of the rotation is the distance from the pivotPoint to the position of the node. But it's not needed in this case.
Code: Select all
core::vector3df pivotPoint( 100, 100, 100 );
core::vector3df tempPos = node->getPosition();
tempPos -= pivotPoint;
core::matrix4 rotMat;
rotMat.setRotationDegrees( core::vector3df( 45, 45, 45 ) );
rotMat.rotateVect( tempPos );
node->setPosition( tempPos + pivotPoint );
I don't know what you mean by radius. What does the radius have to do with rotation? I guess, the radius of the rotation is the distance from the pivotPoint to the position of the node. But it's not needed in this case.
the radius imply that Abraxas want an -orbit- around an instance (pivotpoint)
i know the formula -but there is also the rotationAnimator..
Wouldent it be the simplest way?
The gfx tut has an orbitting light source..
but change it in game loop..
hmm.. :shock:
i know the formula -but there is also the rotationAnimator..
Wouldent it be the simplest way?
The gfx tut has an orbitting light source..
but change it in game loop..
hmm.. :shock:
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
-
- Posts: 93
- Joined: Tue Feb 08, 2005 12:19 pm