Page 1 of 1

Relative movement of a scene node

Posted: Fri Dec 28, 2007 9:42 pm
by hammeraxe
sorry for my n00b question but thats what this forum is for right..?

so my question is:
is it possible to move a scene node relative to its rotation?
e.g. moving a node 3 units forward, not along the x/y/z axis, but the direction the node is facing

because when i use setPosition() i can only specify world coordinates...

and one more quick question
apparently there is no function that returns the mouse movement during the last frame... so i should probably write it myself storing the mouses coordinates every frame and subtracting the new coordinates... do i have to use position2d or vector2d for storing them?

Posted: Fri Dec 28, 2007 9:48 pm
by LosNir
What do you mean "direction the node is facing", if it's a cube, where does it face?

X = left / right
Y = up / down
Z = forward / backward

Code: Select all

node->setPosition(vector3df(X, Y, Z))
to take the node 3 units ahead, use:

Code: Select all

node->setPosition(node->getPosition+vector3df(0,0,3))
3 units up:

Code: Select all

node->setPosition(node->getPosition+vector3df(0,3,0))
and so on with the X axis.

==================

for you second question, i guess it's position2d.

Posted: Fri Dec 28, 2007 10:03 pm
by hammeraxe
i found answer to my first question here: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=25424


thanks anyway