Rotating Velocity

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
SumWon
Posts: 1
Joined: Wed May 06, 2009 4:25 am

Rotating Velocity

Post by SumWon »

Hi, I have a vector for an object's velocity, for example <1.85,-2.24,1.59> and I want to make a function to rotate it for me so I can supply the velocity and the rotation to rotate it by so I could rotate the direction the object is moving along any given axis. I'm not the greatest with math and cannot find a solution for this on my own, so any help would be appreciated, thanks =D.
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

This depends on and if your using a phys engine, if so what one are you using? for example the irrnewt has getdirection functions. Also irrlicht has rotation to direction.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

If I'm understanding what you're looking for, you just need to transform the velocity vector using the nodes transformation.

Code: Select all

// this is vector points 'forward' for any given object
core::vector3df forward(0.f, 0.f, 1.f);

// now forward is forward for node
node->getRelativeTransformation().rotateVect(forward);

// if you know node is a child of the root scene node, you could write
node->getAbsoluteTransformation().rotateVect(forward);
Travis
Post Reply