Ogre + Bullet combination - best practices?
-
- Posts: 8
- Joined: Sun Feb 14, 2010 8:26 pm
Ogre + Bullet combination - best practices?
I'm writing a project using Ogre + Bullet combination. Could anyone help with advice about best practices for this combination? What's the best way to keep Ogre and Bullet objects in sync? Is there anything special about keeping kinematic object in sync with its Ogre representation?
Any personal experience with this combination would be appreciated.
Any personal experience with this combination would be appreciated.
-
- Posts: 22
- Joined: Thu Mar 05, 2009 9:41 pm
Re: Ogre + Bullet combination - best practices?
Hi,
I'm making a thesis on bounding volume with bullet and ogre... I saw physX with NxOgre in my past (it's wrapper..etc).
I choose to use the Bullet library directly for learning better the use of an physics engine and the use with the 3d engine (in our case, Ogre). I think that it depents from what you want. If you want to make simple things easy... use ogrebullet. if you want to explore many thing of an physics engine and the 3D physics communication... use bullet library. You have to know, that if you want to make complex thing with ogrebullet you have to use bullet directly because the wrappers (often) doesn't have the complete functionality.
You have to know , if you would like to learn bullet directly... that you'll learn the use of an 3d physic engine and the things that you learn.. will go well for physX, ode etc. etc.
Using the bullet library directly, brings you to have to make many things in mechanically mode... and it's better to make one your wrapper for make the 3D physic scene and 3D graphic scene coherent, for example deriving the class btMotionState to update your sceneNode... like it is explained in the bullet manual.
I hope these informations will be useful for you..
I'm making a thesis on bounding volume with bullet and ogre... I saw physX with NxOgre in my past (it's wrapper..etc).
I choose to use the Bullet library directly for learning better the use of an physics engine and the use with the 3d engine (in our case, Ogre). I think that it depents from what you want. If you want to make simple things easy... use ogrebullet. if you want to explore many thing of an physics engine and the 3D physics communication... use bullet library. You have to know, that if you want to make complex thing with ogrebullet you have to use bullet directly because the wrappers (often) doesn't have the complete functionality.
You have to know , if you would like to learn bullet directly... that you'll learn the use of an 3d physic engine and the things that you learn.. will go well for physX, ode etc. etc.
Using the bullet library directly, brings you to have to make many things in mechanically mode... and it's better to make one your wrapper for make the 3D physic scene and 3D graphic scene coherent, for example deriving the class btMotionState to update your sceneNode... like it is explained in the bullet manual.
I hope these informations will be useful for you..
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Ogre + Bullet combination - best practices?
You might also want to try out gamekit, at http://gamekit.googlecode.com There is a branch using Ogre, called OgreKit. GameKit can directly extract any information from a Blender 3D .blend file, including graphics meshes, packed textures, skeletal animation, collision, rigid body data and constraints.
Thanks,
Erwin
Thanks,
Erwin
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Ogre + Bullet combination - best practices?
There's nothing special about interacting with ogre. Just update the scene node from the bullet callback. Also, don't derive bvh meshes from your ogre meshes no matter how tempting it might be. Make special bullet shapes that closely resemble the ogre meshes. There is an Ogre debug drawer available on a wiki somewhere, which is useful (google for it). You should use that as a priority because it is indispensable for debugging.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Ogre + Bullet combination - best practices?
Why is that? For static (non-moving, mass=0) world geometry, using btBvhTriangleMeshShape should work fine.Also, don't derive bvh meshes from your ogre meshes no matter how tempting it might be.
Thanks,
Erwin
-
- Posts: 8
- Joined: Sun Feb 14, 2010 8:26 pm
Re: Ogre + Bullet combination - best practices?
First of all, thanks for the answers.
My problem is that I would like to load object models from Collada file(s). My idea is to use existing Collada loaders for Bullet and Ogre, and then connect models in my code. I don't know if it's possible to use custom motion state when loading models with Collada loader into Bullet. Does anyone have a suggestion (or code sample) how to do this, or some other way to connect Bullet and Ogre models?
If you think that this could be achieved more easily with some file format other than Collada, feel free to suggest it, as long as there are free tools available for content creation.
Note: I've already posted this question to Ogre forums, but had no responses so far.
http://www.ogre3d.org/forums/viewtopic.php?f=5&t=55645
My problem is that I would like to load object models from Collada file(s). My idea is to use existing Collada loaders for Bullet and Ogre, and then connect models in my code. I don't know if it's possible to use custom motion state when loading models with Collada loader into Bullet. Does anyone have a suggestion (or code sample) how to do this, or some other way to connect Bullet and Ogre models?
If you think that this could be achieved more easily with some file format other than Collada, feel free to suggest it, as long as there are free tools available for content creation.
Note: I've already posted this question to Ogre forums, but had no responses so far.
http://www.ogre3d.org/forums/viewtopic.php?f=5&t=55645
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Ogre + Bullet combination - best practices?
If you are using the BulletColladaConverter, you can override the virtual 'createRigidBody' method and create your motionstate there (just copy and modify the original implementation of BulletColladaConverter::createRigidBody)
What modeler are you using to export the COLLADA files? Does it contain COLLADA physics information (collision shape type, rigid body mass, friction, constraints)?
For Maya we have the Dynamica plugin, that exports both COLLADA Physics and .bullet binary format. You might want to check out the binary .bullet format too. It has a similar virtual 'createRigidBody' you can override.
Thanks,
Erwin
What modeler are you using to export the COLLADA files? Does it contain COLLADA physics information (collision shape type, rigid body mass, friction, constraints)?
For Maya we have the Dynamica plugin, that exports both COLLADA Physics and .bullet binary format. You might want to check out the binary .bullet format too. It has a similar virtual 'createRigidBody' you can override.
Thanks,
Erwin
-
- Posts: 8
- Joined: Sun Feb 14, 2010 8:26 pm
Re: Ogre + Bullet combination - best practices?
Thanks Erwin. Do you know if there is an exporter for blender that exports .bullet files?
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Ogre + Bullet combination - best practices?
If you carefully design the graphics mesh then it can work, but there are loads of things you can get away with in graphics that you can't in Bullet. You need to keep careful watch on the triangle complexity so that you avoid having physical artifacts and nooks/crannies that break things. It can also affect performance to have too many triangles because if your triangles are smaller you end up intersecting with more of them. It all depends on what other shapes you have in the scene of course. If all you're doing is tilting a ball around a maze then it probably doesn't matter at all. But if you're doing a racing game with high velocity concave/static collisions then you have to be a bit more careful. Also there are things you can get away with in Bullet that you can't do in graphics without causing things like shadow artifacts. So, to lock the two together in the early stages of development would be a mistake. Although you can in many cases export the same mesh from the modeller into both graphics and physics forms, maybe with minor tweaks first to remove some details.Erwin Coumans wrote:Why is that? For static (non-moving, mass=0) world geometry, using btBvhTriangleMeshShape should work fine.Also, don't derive bvh meshes from your ogre meshes no matter how tempting it might be.
Thanks,
Erwin
This is my experience anyway.
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: Ogre + Bullet combination - best practices?
Just to say that I've been using Ogre and Bullet together for some year, and what I did was to derive a physic model (verts + inds) from an Ogre mesh by removing double vertices. This way vertices can be reduces about by 20% (or even more on some meshes) and the performance is better.
The main problem with this approach is that I wasn't able to implement a multi-material bvh triangle mesh, since now the physic mesh indices have changed.
Anyway most of the time passing the whole Ogre mesh to Bullet without stripping double vertices just works, when used as static bvh triangle mesh.
Hope this helps.
The main problem with this approach is that I wasn't able to implement a multi-material bvh triangle mesh, since now the physic mesh indices have changed.
Anyway most of the time passing the whole Ogre mesh to Bullet without stripping double vertices just works, when used as static bvh triangle mesh.
Hope this helps.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Ogre + Bullet combination - best practices?
I modified the latest stable version of Blender (2.49b) added .bullet export support, through a Python command in the game engine:elojd wrote:Thanks Erwin. Do you know if there is an exporter for blender that exports .bullet files?
Code: Select all
import PhysicsConstraints
PhysicsConstraints.exportBullet("fileName.bullet")
You can also directly extract physics information from a .blend file, that is what we do in gamekit.
Using gamekit, it would be easy to create a .blend to .bullet extractor/convertor. If there is interest in this, please let me know.
Thanks,
Erwin
-
- Posts: 13
- Joined: Wed Jan 20, 2010 1:35 am
Re: Ogre + Bullet combination - best practices?
I get "No module named PhysicsConstraints."Erwin Coumans wrote:elojd wrote:Thanks,Code: Select all
import PhysicsConstraints PhysicsConstraints.exportBullet("fileName.bullet")
Erwin
Do I need to set anything up or import anything else to use this?
-
- Posts: 7
- Joined: Sun Apr 11, 2010 12:12 pm
Re: Ogre + Bullet combination - best practices?
I am getting the same problem. I am using the precompiled blender version. Anybody know what the problem could be?dakffyd wrote:
I get "No module named PhysicsConstraints."
Do I need to set anything up or import anything else to use this?
-
- Posts: 3
- Joined: Sat Jun 19, 2010 12:10 pm
Re: Ogre + Bullet combination - best practices?
Maybe this can help you ? http://bulletphysics.org/Bullet/phpBB3/ ... 165#p19165. The game engine must be running before the script can work (as far as I understand the thing). Look at the sample scene.