Search code examples
c++irrlicht

Why setting the sceneManager as parent of a sceneNode throws error in Irrlicht?


I've created an IAnimatedMeshSceneNode in Irrlicht, i set null pointer when creating it from the addAnimatedMeshSceneNode function of the scene manager.

As desired, the animated mesh is created successfully. When I change the parent of this animated node using the function setParent(ISceneNode* parent), it work when the parent is pointing on an existing node.

But when I set the SceneManager pointer as parent of the animated node again or if I set null parent to it, the application crash and I know the execution throws error on the setParent(mySceneManager).

How can I set the root node (sceneManager) as parent when my animated node has already been created?


Solution

  • You can set the Parent of an IAnimatedMeshSceneNode like this:

            node->setParent(smgr->getRootSceneNode());
    

    In this case node the the IAnimatedMeshSceneNode and smgr is my ISceneManager.

    :)