Page 1 of 1

void ISceneNode::setMatrix ( const core::matrix4& m)

Posted: Wed Aug 22, 2012 4:32 am
by clarks
Why is there not a method like this in irrlicht for scene nodes? It does not make any sense at all. Reason being is because it is very useful to have such a function especially for physic engines that return matrices of rigid bodies. It does not make sense to get the rotation from one matrix (physics engine) and then call ISceneNode->setRotation( rotation ), that is just unnecessary calculations being performed. There should be a method to just set the matrix of the scenenode.

Code: Select all

 
void ISceneNode::setMatrix( const core::matrix& m );
 
OR
 
void ISceneNode::setTransform( const core::matrix& m );
 

Re: void ISceneNode::setMatrix ( const core::matrix4& m)

Posted: Wed Aug 22, 2012 7:38 am
by hybrid
The reason is that you cannot set rotation or scale separately, without major overhead in calculations. You have to separate the original values from the matrix, exchange, and get the new matrix again. In worst case each frame. We save us the overhead and only create the matrix back again. This also saves space, as rotation, scale, and translate are 3d vectors, hence 7 floats less.

Re: void ISceneNode::setMatrix ( const core::matrix4& m)

Posted: Wed Aug 22, 2012 8:24 am
by CuteAlien
There is also IDummyTransformationSceneNode - you can add those as parents of your scenenode and they do work with matrices instead. There is a little overhead as the scenenode still does it's own local transformations which can't be disabled so far.

Re: void ISceneNode::setMatrix ( const core::matrix4& m)

Posted: Wed Aug 22, 2012 3:38 pm
by Mel
For not to speak of handedness, Irr uses left hand matrices, row major matrices, while some Physics engine use left handed (newton), and other right handed (bullet), row major, column major... so, the matrix transformations may not always work as expected, thus it is less complex to extract the proper values from the matrices, and in most cases, this involve less operations than the raw matrix multiplications.