c++ - 为什么将 sceneManager 设置为 sceneNode 的父级会在 Irrlicht 中抛出错误?

标签 c++ irrlicht

我在 Irrlicht 中创建了一个 IAnimatedMeshSceneNode,我在从场景管理器的 addAnimatedMeshSceneNode 函数创建它时设置了空指针。

如愿,动画网格创建成功。当我使用函数 setParent(ISceneNode* parent) 更改此动画节点的父节点时,它会在父节点指向现有节点时起作用。

但是,当我再次将 SceneManager 指针设置为动画节点的父级时,或者如果我将其设置为 null 父级时,应用程序崩溃并且我知道执行会在 setParent(mySceneManager) 上抛出错误。

当我的动画节点已经创建时,如何将根节点 (sceneManager) 设置为父节点?

最佳答案

您可以像这样设置 IAnimatedMeshSceneNode 的父节点:

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

在这种情况下,IAnimatedMeshSceneNode 和 smgr 节点是我的 ISceneManager。

:)

关于c++ - 为什么将 sceneManager 设置为 sceneNode 的父级会在 Irrlicht 中抛出错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34492396/

相关文章:

c++ - C++11 中使用模板参数的递归可变参数 void 函数

c++ - 在 Xcode 和 Eclipse 中输出 char 数组

c++ - 在类构造函数中使用vector时发生运行时错误?

c++ - 不一致警告 : variable might be clobbered by ‘longjmp’ or ‘vfork’

c++ - 在 C++ 中创建 Wavefront .obj 文件(网格 3D)

c++ - 从基类继承两次时如何修复 "error: no matching function for call to"

c++ - Irrlicht 正在错误路径中查找文件

c++ - 带有 protobuf 的模糊符号字符串

c++ - 在围绕一个点的圆圈中创建对象