Inelastic collisions

Digitalghost
Posts: 25
Joined: Thu Dec 20, 2007 4:03 am

Inelastic collisions

Post by Digitalghost »

Hey all,

I managed to get my ragdoll system with bullet working, but the collisions do not look right. The objects are much too rigid to look human. When a ragdoll flies into another player (represented as kinematic physics bodies) the ragdoll "bounces off" in a very unrealistic way. The collisions look very elastic and I was thinking if there was some way to enable inelastic collisions or set the "bounciness" of a rigid body, I could make it so that if a ragdoll collides with a wall or a person, the ragdoll with not bounce and fly far away in the other direction, but instead fly over the person or collapse against the wall, etc.

I looked through btRigidBody but I could not find a parameter for elasticity or bounciness, is there some other way to make contacts less elastic?
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: Inelastic collisions

Post by ola »

Hi,

the "bounciness" parameter you are looking for is called "restitution". If you set it to zero things won't bounce much at all. It's valid range is from 0.0 to 1.0.

Maybe setting some damping (linear and angular) will improve your results as well.

Best regards,
Ola :-)
jackskelyton
Posts: 32
Joined: Mon Nov 05, 2007 3:52 pm

Re: Inelastic collisions

Post by jackskelyton »

There's no accessor to the restitution variable in btRigidBody. How do we change restitution?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Inelastic collisions

Post by Erwin Coumans »

btRigidBody is derived from btCollisionObject, so it has a all its methods, including:

Code: Select all

void	setRestitution(btScalar rest);
btScalar	getRestitution() const;
Thanks,
Erwin
jackskelyton
Posts: 32
Joined: Mon Nov 05, 2007 3:52 pm

Re: Inelastic collisions

Post by jackskelyton »

Of course. Just tried it, and there appears to be no change in the "bounciness" of the object with restitution at 0 or 1. Are there other properties we need to take into consideration that might be overriding it?