Hello everyone, i'm very new to 3D engines and Irrlicht.
I did some Tutorials with creating a cube scene node and rotating it.
But if i load a custom 3D Model as an animatedMeshScene Node and try to rotate it,
it does not behave like for example the cube scene node.
I think the reason is that the point of origin from the cube scene node is at its center
and the point of origin from my model is somewhere outside of it, i think bottom left corner.
It there a way to rotate my model so that it will behave like the cube ?
thanks in advance
Rotating an Animated mesh scene node
Re: Rotating an Animated mesh scene node
Combine (translate to centre) x (rotate) x (translate from centre).
Or go back into your modeller and translate it there. The mesh that Irrlicht is loading has absolute vertex positions so you cannot expect it to know where the centre is.
Or go back into your modeller and translate it there. The mesh that Irrlicht is loading has absolute vertex positions so you cannot expect it to know where the centre is.
Re: Rotating an Animated mesh scene node
Thanks for your answer, mongoose7!
But could you show me some example code snipplet for it ?
But could you show me some example code snipplet for it ?
Re: Rotating an Animated mesh scene node
Hello smso,
i just tried your given code snippets
rotateNodeInWorldSpace and
rotateNodeInLocalSpace
and changed them a little so it would work for AnimatedMeshSceneNode.
I Called rotateNodeInWorldSpace(myModel, 90,core::vector3df(0,1,0)) to rotate it around its y axis,
but it still does not rotate around "itself" but around another axis.
the same Happens with rotateNodeinLocalSpace
i just tried your given code snippets
rotateNodeInWorldSpace and
rotateNodeInLocalSpace
and changed them a little so it would work for AnimatedMeshSceneNode.
I Called rotateNodeInWorldSpace(myModel, 90,core::vector3df(0,1,0)) to rotate it around its y axis,
but it still does not rotate around "itself" but around another axis.
the same Happens with rotateNodeinLocalSpace
Re: Rotating an Animated mesh scene node
or can anyone show me a small and easy program to change the translation of the coordinate system?
Re: Rotating an Animated mesh scene node
It seems that your model is not centered at the origin. Try revolveNodeInLocalSpace() instead.
pivot is the offset from the origin
Regards,
smso
Code: Select all
void revolveNodeInLocalSpace(scene::ISceneNode* node, f32 degs, const core::vector3df& axis, const core::vector3df& pivot)
...Regards,
smso
Re: Rotating an Animated mesh scene node
Thanks a lot!
This method worked for me,
though it was a bit of try and error to find a good pivot vector
This method worked for me,
though it was a bit of try and error to find a good pivot vector