Im having a simple problem. Im rotating a scene node, and after rotation trying to move it in the direction its facing. But as I have discovered, when a scenenode is rotated its axis (x,y,z) are not.
So Im wondering if there is a way to rotate the axis of a scene node...?
And if that method doesnt exist in IRRLicht, what is then the simplest and least CPU intensive way to calculate direction...?
Move in a direction...?
I dont know whether this helps you, but you could save
the angle each time you rotate the scene node. In the beginning
I think the rotation is 0. So if you rotate the Scene Node
you can:
rotation+=(amount you rotate the node)
moving a node can work (for example) like this:
you just get the position of it, here it is point A.
Then you may want to move to point B and calculate
the vector between it:
(B-A).normalize()*speed*time
then just add it to A and set the new position.
you can can leave the time away, if you dont want to code it time based.
the angle each time you rotate the scene node. In the beginning
I think the rotation is 0. So if you rotate the Scene Node
you can:
rotation+=(amount you rotate the node)
moving a node can work (for example) like this:
you just get the position of it, here it is point A.
Then you may want to move to point B and calculate
the vector between it:
(B-A).normalize()*speed*time
then just add it to A and set the new position.
you can can leave the time away, if you dont want to code it time based.
Re: Move in a direction...?
Have you looked at scenenode->getRotation()?Lovehina wrote:But as I have discovered, when a scenenode is rotated its axis (x,y,z) are not.
Sorry, I didnt have time to respond. Heizi thank you for your answer but that doesnt help me much. In your case I would have to know the next point to which Im supose to move, but in my case that is pointless.
Please be more specific, I have no idea what you mean with this...Have you looked at scenenode->getRotation()?
There is a magic file included to the sdk, called Irrlicht.chm !!!
Open it and search for getRotation...
Open it and search for getRotation...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java