从文件加载 Bullet 物理网格
我正在尝试使用 Ogre 和 Bullet 设置城市环境,但我无法弄清楚如何将网格加载到 Bullet 中。 Google 显示了对 Collada 导入程序的引用,但这似乎已从 SVN 中删除。
Ogre 网格是最好导入的,但我也有 .dae 和 .blend 文件,如果可能的话可以使用这些文件。
I'm trying to set up a city environment with Ogre and Bullet, but I'm having trouble figuring out how to load meshes into Bullet. Google shows references to a Collada importer, but that seems to have been removed from the SVN.
The Ogre mesh would be the best thing to import, but I have the .dae and .blend files as well and could use those if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当我使用 Bullet 和 Irrlicht 时,我也有同样的要求。除了自己编写物理加载代码之外,我没有找到解决方案。我在 3D 编辑器中使用了对象命名约定,并且在加载模型时,我迭代了子对象并为每个标记的对象构建了合适的 btRigidBody。
例如,
与关节类似:
createSphereBody() 函数根据网格顶点计算半径。
希望有帮助。
I had the same requirement when using Bullet with Irrlicht. I found no solution apart from writing the physics loading code myself. I used an object naming convention in the 3d editor, and when loading a model, I iterated through the sub-objects and constructed a suitable btRigidBody for each tagged object.
E.g.
Similarly with joints:
The createSphereBody() function calculated the radius from the mesh verts.
Hope that helps.
如果您使用 3DS Max 进行建模,则可以使用 OgreMax 插件从 OGRE 导出场景,并使用 3DS Max 的项目符号插件导出物理对象。您可以将这两组分别加载为 OGRE 节点和子弹对象,并根据它们的名称组合物理/图形模型。
这就是我在自己的游戏中所做的:
来源:https://github.com/SabinT/混沌之翼
演示:http://www.youtube.com/watch? v=eryWgIuqC7I
我很久以前就停止了这方面的工作,但希望这段代码对从事 Ogre/Bullet 工作的人有所帮助。也许有人会从中收集到一些有用的代码。
您可能会对 CsGameLevel.cpp 文件感兴趣。
Load()方法首先加载Ogre场景,然后通过LoadStaticGeometry()方法加载子弹刚体。
If you're using 3DS Max for modeling, you can use the OgreMax plugin for exporting the scene fro OGRE, and the bullet plugin for 3DS Max to export physics objects. You can load those two sets separately as OGRE nodes and bullet objects, and combine the physics/graphics models based on their names.
This is how I did it in my own game:
Source: https://github.com/SabinT/Wings-Of-Chaos
Demo: http://www.youtube.com/watch?v=eryWgIuqC7I
I stopped working on this a long time ago, but hope this code proves helpful for someone working on Ogre/Bullet. Perhaps someone will glean some useful code out of this.
You'd be interested in the CsGameLevel.cpp file.
The Load() method first loads the Ogre scene, then loads the bullet rigidbodies through the LoadStaticGeometry() method.