Capsule collider introducing energy into the system?!

Kulik
Posts: 10
Joined: Sun Jul 18, 2010 1:19 am

Capsule collider introducing energy into the system?!

Post by Kulik »

Hi,
I have created a wrapper for Ogre and Bullet to create some test simulations. Everything is going fine, I have even included a debug drawer and the primitive collision shapes - box, sphere, cylinder and capsule. Out of these 4, just the capsule is acting really weirdly.

I spawn a capsule shaped object with a capsule collider and they fall to the ground, reacting properly, but then they continue to roll infinitely, never stopping. Damping is on - angular and linear, friction is 0.8 for all objects in the simulation to keep things simple, restitution is 0.5, everything weights 1 kg. Cylinder rolls but slows down and deactivates after couple of seconds.

Can't figure this out... Any ideas? I have tried searching, but nothing relevant popped out :-(

A simple youtube video to illustrate the problem. Everything works OK, but capsules keep rotating and never deactivate themselves.
http://www.youtube.com/watch?v=Hr7mHohcZiU

Hopefully, I will be able to release the code, but I have to clean things a little before that happens, so no actual code available. However I am not doing anything fancy, everything is taken from Bullet documentation or samples.
Kulik
Posts: 10
Joined: Sun Jul 18, 2010 1:19 am

Re: Capsule collider introducing energy into the system?!

Post by Kulik »

I am very sorry, I forgot to mention - Bullet Version 2.76

Ogre version probably isn't relevant to this problem...
Eric_A
Posts: 6
Joined: Wed May 06, 2009 4:42 am

Re: Capsule collider introducing energy into the system?!

Post by Eric_A »

That's funny; I'm having the exact same problem, except it's happening with cylinders and not capsules for us. If the cylinder lands on one of its flat ends then it kind of shakes and wobbles and slides across the ground. If it is on its rounded side then it will perpetually roll with ever increasing speed. We're using Bullet2.75-RC7.
chrozz
Posts: 8
Joined: Fri Mar 12, 2010 10:21 pm

Re: Capsule collider introducing energy into the system?!

Post by chrozz »

Though it may be deeper problem with bullets simulation, a solution could be setting a higher lin,ang damping on your bodies.
http://www.bulletphysics.com/Bullet/Bul ... dd4d20114b
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Capsule collider introducing energy into the system?!

Post by Dirk Gregorius »

This could be due to the contact caching. If an old point is used this will introduce an artificial torque into the system. Imagine a circle on the a plane. If the contact point is not exactly below the circle center (in direction of the contact normal) this introduces an artificial torque.

You should be able to detect such contact points and reject them in a callback. E.g. you could try to discard all contact points that don't project onto the inner segment of the capsule.


HTH,
-Dirk