math problem

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
Blade
Posts: 9
Joined: Wed Sep 05, 2007 4:07 pm

math problem

Post by Blade »

I guess i have a mathematics problem but perhaps, there is a better way in Irrlicht to get what I want:

I want a aabbox3df to follow a scene node (not the bounding box). All i've got is a matrix4 where the rotation and translation of the node is stored. So i can get matrix4->getRotationDegrees() and matrix4->getTranslation().

Here is my code:

Code: Select all

void Update() // not an Irrlicht Update function
{
actmat.getTransformInformation();
lastmat.transformBox(physbox);
actmat.transformBox(physbox);
actmat.getInverse(lastmat);
}
I'm sure i get the right information because with this actmat matrix i also change the position and rotation of my scenenode.

I also tried to transform the MinEdge and MaxEdge vectors of aabbox3df but it didn't work either
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

The nodes bounding box does follow it around, provide that you transform it using the nodes absolute transformation...

Code: Select all

core::aabbox3df box = node->getBoundingBox();
node->getAbsoluteTransformation().transformBoxEx(box);
// box should be positioned where node is
If you have the rotation and position of a scene node, you should be able to do essentially the same thing..

Code: Select all

core::matrix4 m;

// it is safe to put a translate and a rotate into a matrix like this,
// just don't apply a scale
m.setTranslation(translation);
m.setRotation(rotation);

m.transformBoxEx(box);
Travis
Post Reply