Relative movement of a scene node

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
hammeraxe
Posts: 9
Joined: Sun Nov 04, 2007 4:51 pm
Location: LV

Relative movement of a scene node

Post 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?
LosNir
Posts: 43
Joined: Wed Dec 19, 2007 6:38 pm
Location: Israel
Contact:

Post 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.
hammeraxe
Posts: 9
Joined: Sun Nov 04, 2007 4:51 pm
Location: LV

Post by hammeraxe »

i found answer to my first question here: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=25424


thanks anyway
Post Reply