relative coordinates

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
Hobi
Posts: 14
Joined: Sun Jul 25, 2004 9:32 am

relative coordinates

Post 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.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post 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);
Hobi
Posts: 14
Joined: Sun Jul 25, 2004 9:32 am

Post by Hobi »

thankyou arras!

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