Does Bullet allow objects to "penetrate" each othe

balthazar
Posts: 4
Joined: Sun Dec 17, 2006 11:27 pm

Does Bullet allow objects to "penetrate" each othe

Post by balthazar »

Hey,

This is a newbie question! I'm planning to make a 2D game, which includes some fast moving smaller objects. Because bullet uses continuous collision detection I thought the bullet physics library might be appropriate for dynamics. I just have one question about it: Because 2D graphics may be very revealing (nothing is obscured by other parts), it may look strange if two objects visually penetrate each others when they collide. Can Bullet be used such a way that this does not happen (visibly), and neither that there is a visible space between them? I see Bullet computes time-of-impact, does that mean that Bullet can solve that specific problem? It would be nice to have it "pixel-perfect".

I see there's a 0.04 collision margin on each object. Is it possible to either scale the world/graphics in such a way that this is not visible, or draw the graphics so that the margin is included?

Also, I'm wondering whether using Bullet with ODE (like the demo shows), also lets you avoid any penetration of the objects. I'm asking all these questions in advance, so that I don't have to spend hours and hours trying to implement something with the wrong tool... :)

Per
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Does Bullet allow objects to "penetrate" each

Post by Erwin Coumans »

Bullet only supports 3D collision detection and rigidbody dynamics, no 2D (yet). Also, although Bullet collision detection features time-of-impact calculation this features is not used in the dynamics loop of btDiscreteDynamicsWorld. In 2007 there will be btContinuousDynamicsWorld, that uses Bullet's time of impact calculation.

Apart from that, Bullet resolves penetrations fine. And you can indeed compensate the collision tolerance for the graphics. Read the Bullet_User_Manual.pdf, some shapes have the margin 'inside', so no compensation is needed: sphere, box for example have the margin inside (part of radius/half extents).
balthazar wrote: Also, I'm wondering whether using Bullet with ODE (like the demo shows), also lets you avoid any penetration of the objects.
Per
Bullet uses its own collision detection and constraint solving. It does not use or rely on ODE, but there is some comparison option. Which demo are you referring too? CcdPhysicsDemo uses Bullet's btSequentialImpulseConstraintSolver by default.

Thanks,
Erwin
balthazar
Posts: 4
Joined: Sun Dec 17, 2006 11:27 pm

Re: Does Bullet allow objects to "penetrate" each

Post by balthazar »

Which demo are you referring too?
Actually, I wasn't referring to a demo, but the file under Extras, test_BulletODE.cpp, which seems to use Bullet's collision detection with ODE's dynamics. But I suppose that question is really answered anyway.

When you wrote:
Apart from that, Bullet resolves penetrations fine.

Does this mean that it moves the objects out of penetration, so that it is not visible? In that case, it probably solves my problem. Otherwise, I wonder if it would work to "manually" move the objects out of penetration when two objects collide, as a temporary solution, untill btContinuousDynamicsWorld is ready?

Per
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Does Bullet allow objects to "penetrate" each

Post by Erwin Coumans »

balthazar wrote: Does this mean that it moves the objects out of penetration, so that it is not visible? In that case, it probably solves my problem. Otherwise, I wonder if it would work to "manually" move the objects out of penetration when two objects collide, as a temporary solution, untill btContinuousDynamicsWorld is ready?
Per
Have you played with the Bullet 2.40 demos (in particular the CcdPhysicsDemo) ? You can interact with the mouse to cause penetration, and Bullet with just recover fine.

This is different from btContinuousDynamicsWorld and using the time-of-impact to step the simulation. This prevents (deep) penetrations from happening, and it prevent missing collisions all together. Missing collision entirely can not be recoved by penetration depth obviously.

Thanks,
Erwin