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

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
clarks
Posts: 35
Joined: Sat Jul 28, 2012 5:23 am

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

Post 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 );
 
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

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

Post 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.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

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

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

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

Post 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.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply