Page 1 of 1

How to rotate a Node around a user specific axis ?

Posted: Sun Mar 16, 2008 7:52 am
by paddy
Hi there,

as my question in the beginners forum isnt solved till now, I'm asking the last part of it here. Is it possible (btw it is) to rotate a Node around an axis != X, Y, Z ?

I'm not that into mathematics. I have the angle and the axis (vector3df). But no idea how to apply this to a Node.

Is there any possibilty to split up the axis vektor so it fits into the normal X / Y / Z Rotation ? But then i need 2 more angles right ?

Maybe its more easier using matrix4 functons ?

paddy3k

Re: How to rotate a Node around a user specific axis ?

Posted: Sun Mar 16, 2008 12:38 pm
by doqkhanh
paddy wrote:Is it possible (btw it is) to rotate a Node around an axis != X, Y, Z ?
Read a computer graphic course for very basic thing like this..

The answer is: YES

Try apply to your node:

Code: Select all

node->setRotate(core::vector3df(0.0,180.0,0.0));

node->setRotate(core::vector3df(18.0,0.0,0.0));

node->setRotate(core::vector3df(0.0,0.0,18.0));

Posted: Sun Mar 16, 2008 1:22 pm
by arras
In case you mean custom axis (like rotation relative to already rotated node):

Code: Select all

vector3df axis;
irr::core::matrix4 m;
m.setRotationDegrees(axis);
irr::core::matrix4 n;
n.setRotationDegrees(yourRotation);
m *= n;
vector3df rot = m.getRotationDegrees();
Look at this post if you need it for turn pitch roll: Free Flight

Re: How to rotate a Node around a user specific axis ?

Posted: Sun Mar 16, 2008 3:24 pm
by rogerborg
doqkhanh wrote:
paddy wrote:Is it possible (btw it is) to rotate a Node around an axis != X, Y, Z ?
Read a computer graphic course for very basic thing like this..

The answer is: YES

Try apply to your node:

Code: Select all

node->setRotate(core::vector3df(0.0,180.0,0.0));

node->setRotate(core::vector3df(18.0,0.0,0.0));

node->setRotate(core::vector3df(0.0,0.0,18.0));

Image

Oh, the humanity!

Posted: Sun Mar 16, 2008 4:04 pm
by doqkhanh
axis != X, Y, Z ? :shock:

Posted: Sun Mar 16, 2008 8:42 pm
by Halifax
doqkhanh wrote:axis != X, Y, Z ? :shock:
Actually, buddy, it is the X, Y, Z axis that you showed how to rotate around.

He wants to know how you could define an axis of say...{1,1,0} and then rotate the node around that. (X = {1,0,0}; Y = {0,1,0}; Z = {0,0,1}.)