Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

d3dx helper and the bullet engine

This topic is 2540 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Currently, I am implementing all my code with the d3dx helpers. If I want to incorporate physics engine like bullet into my code base, Do I have to give up using the helpers and concentrate on using the interfaces provided by the bullet engine instead? At the moment, I am using stuff like D3DXCreateKeyFramedAnimation and All those animation controllers functions available, is it going to be a fat chance to keep my d3dx helper code if I need the physics functionality?
PS: I understand d3d9 can be used as the renderer
Thanks
Jack

Share this post


Link to post
Share on other sites
Advertisement
The good news: you can indeed use d3d9 with d3dx and bullet.
The bad news is that there's no clear cut. For keyframed animation I'm afraid there's no good solution available. Bullet does indeed allow to change the collision shape on a per-frame basis as it does not mandate it is constant. I'd be extremely careful in doing that, odds are it will just trash a lot of optimizations.
Don't even think about using graphical meshes for collision. You'll be very sorry, unless you expect all your users to have core i7. See the bottom of this page to have an idea of the simplification required. Even if you can afford the performance, odds are simplified collision shapes might give more stable results.

But back to the point. How to do this?
I suggest to just tell bullet to track the mesh in terms of a capsule/box/hull. When a collision is detected, trigger your own per-triangle tests. This way, bullet is used more like a "fast reject" test. I haven't had the chance so far to investigate this but I'd expect the performance to be much better of just using a trimesh in the first place.

How to properly approximate a mesh is an open question. There are indeed some ways to do so, most of the time, the convex hull will suffice but I'm afraid you really need more accuracy than that. Personally, I mandate each model to provide an internal physics representation.

Share this post


Link to post
Share on other sites
Depends what you want to achieve. If you'll decide to make ragdoll then you cannot use D3D9 provided animation system (unless there's a way to set bone transforms manually). I can't think of anything else what could possibly cause problems.

Share this post


Link to post
Share on other sites
At first blush, I don't actually need complex collision shapes or ragdolls, Simple bounding boxes/volumes are adequate. I am on a rather simple simulation system. Do you think I'd better resort to D3DXComputeBoundingBox etc instead of managing another subtle system in additional to D3DX? Does the system (bullet) handle dead locks (pathfinding) as well?
Which way is better in your opinion?
Thanks
Jack

Share this post


Link to post
Share on other sites

  1. Do you think I'd better resort to D3DXComputeBoundingBox etc instead of managing another subtle system in additional to D3DX?
  2. Does the system (bullet) handle dead locks (pathfinding) as well?
  3. Which way is better in your opinion


  1. To be completely honest, I'd roll a function. Computing bounding spheres or boxes are just a matter of linear scan. Hulls require more work but bullet will do that for you as far as I've understood.
  2. No, it's collision, rigid body dynamics and constraints only. I've read something about recast/detour but I've never used it.
  3. To do what? Comparing to what?

Share this post


Link to post
Share on other sites
The .bullet file is independent to the mesh file (.x file), isn't it?
The bullet file contains the collision shapes and the x file contains the actual meshes. Correct me if i am wrong.
Excuse me about my English, I was actually talking about whether to use Bounding box or the bullet engine, I'd like to know which is better?
Thanks
Jack

Share this post


Link to post
Share on other sites

  1. The .bullet file is independent to the mesh file (.x file), isn't it?
  2. The bullet file contains the collision shapes and the x file contains the actual meshes. Correct me if i am wrong.
  3. about whether to use Bounding box or the bullet engine, I'd like to know which is better?


  1. They are two different, independant files. Notice that there's no real reason to put bullet serialized streams in stand-alone files in the first place. There are two use cases however: 1) World physics is managed perfectly, bullet serialization works just fine 2) mesh physics are a bit more problematic. While bullet supports serialization of a single object, it is not a clear interface IMHO. I have decided to go through an intermediate representation for my system and that gives me quite some peace of mind. The extra code required was actually surprisingly small. I don't expect to use Bullet's object-serialization interfaces any time soon.
  2. Wrong. Bullet serializes a whole world to a byte stream. That includes shape data, rigid bodies (shape instances) and their flags, constraints, current force vectors etc. The serialization method is world-oriented and requires some juggling to become shape- or rigidbody-oriented.
  3. Nonsense. Bounding boxes are the basics of a physics engine. Let me rewrite this so everyone can understand.
    I was actually talking about whether to use wheels or cars. I'd like to know which is better?
    Of course this cannot be answered.

Share this post


Link to post
Share on other sites
1) Is or isn't it hard to implement skinned meshes with bullet? ...
when it can serialize the whole world.
I am not quite confident I can successfully implement all the low-level stuff i need. That's why I am relying on d3dx and bullet. I may be off sometimes.
2) I also notice that each bullet scene is built up from individual pieces/parts. Loading the entire mesh at once altogether is my objective here.
3) Are there any sample code to look at which demostrates the connection between d3d9 and bullet?

Thanks
Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!