Bullet physics collision

Started by
2 comments, last by Aardvajk 9 years, 11 months ago

How do I do collision with bullet physics? I've sponza model which has about 393 subsets. Should I add this all subsets as rigidbody to bullet physics? Is it possible to add/remove rigidbodies/model from being checked from collision using bullet physics? I want to add/remove models from being checked from collision because of frustum culling. If model isn't visible, then I don't want it to be checked for collision. Also how to do collision with this many 393 subsets?

Here is how my scene looks

bsOqs8z.png

Advertisement

In most (all?) physic libraries you're collision detection is no related to what you draw on your screen. You can simplify shapes or groups of shapes that are visually complex with simple shapes for collision. You probably can reduce the number of collision shapes to a really small number of cubes.

Also, only use collision shapes and rigid bodies in objects that need to. What I mean is, if your character (let's assume you have one moving in that place) can´t jump, there's no need to check for collisions in the rounded top of the openings, or the spikes comming out of the walls, or the ceilings.

I used Bullet Physics years ago and I don't remember the syntax, so I can't help you with actual code, but here's the official "Hello World": http://bulletphysics.org/mediawiki-1.5.8/index.php/Hello_World

I don't think you can automatically disable some collision shapes when they're out of the screen, most of the time physic stuffs happen even if you're not looking (enemies would fall through the ground, or they won't be able to throw things at you), but I'm sure you can add/remove the rigid bodies from the "btDiscreteDynamicsWorld" if you want to at any time. Anyway, that sounds like premature optimization, so maybe you should check that feature later if you find that the collision detection is affected by those objects. I think the real intended use of removing something from btDiscreteDynamicsWorld is when that object will never interact again, adding and removing everything might even be worse for performance.

Okay. How does bullet do frustum culling? I mean it doesn't know the information regarding my frustum then how will it do frustum culling? Also another question,

Look at this video :

Why do I keep moving even after touching the ground? it never stops. In video it might seem that I stop moving but it never stops.

Bullet doesn't do frustrum culling. As has been pointed out, what is visible has nothing to do with what requires physic simulation. Bullet has its own methods of broad phase to reduce the physics calculations required each frame.

Re your other question, its probably related to how your friction is set up. However, if you are trying to use a rigid body for a character controller, you're in for a world of pain and frustration. Best to take a look at btKinematicCharacterController instead. Its not complete and has its own issues, but you're unlikely to ever get a rigid body behaving as you want for a character controller.

This topic is closed to new replies.

Advertisement