Page 1 of 1

relative coordinates

Posted: Wed Jul 28, 2004 5:22 pm
by Hobi
Hi!

Is there a way to get the relative coordinate system of a node?
i want to translate a node forwards, that meens along its own z-axis, not along the global z-axis.

Posted: Thu Jul 29, 2004 12:00 am
by arras
There are no "relative" coords in a way you expect.
try folowing:

Code: Select all

irr::core::matrix4 rotMatrix;
rotMatrix.setRotationDegrees( node->getRotation() ); //set it to your node rotation
irr::core::vector3df r = irr::core::vector3df(0,0,distance); //distance you want to move
rotMatrix.transformVect(r); //get relative movement vector
irr::core::vector3df v = node->getPosition();
v += r; //get global vector of new position
node->setPosition(v);

Posted: Thu Jul 29, 2004 10:08 am
by Hobi
thankyou arras!

i already thought, that there are no functions to do that.
so i'll try the math way,