I again have an issue with irrlicht not updating the AbsoluteTransformation of scenenodes for the rendering of the current frame. The core problem is basically the same I had with the updating of my camera, see: http://irrlicht.sourceforge.net/phpBB2/ ... highlight=. I just realized that updating the position of any scenenode can be tricky.
The problem is that when you have a ISceneNode (let's call it node) and do node->setPosition(...) the node will be rendered at the new position in the next frame, in this frame it will be rendered at the old position. Here is why:
setPosition(...) updates the node's RelativeTransformationMatrix, but not it's AbsoluteTransformationMatrix (which is used for the rendering). The AbsoluteTransformation will be updated OnPostRender. To solve this problem you can call node->updateAbsoluteTransformation() which syncs the Absolute- to the RelativeTransformation. Now, I wouldn't bother about 1 additional line of code, but here is another problem:
Now assume node has a parent ISceneNode* (let's call it mom). Further assume the following code:
Code: Select all
mom = smgr->addDummyTransformationSceneNode();
node = smgr->addTestSceneNode(mom);
mom->setPosition(...);
mom->updateAbsoluteTransformation();So when you change a node's transformation, you must call updateAbsoluteTransformation() on all children, too, in order to see the effect in the current frame. This is awkward. I think the engine should be patched so that the user never has to call updateAbsoluteTransformation() himself.
