[FIXED] More elastic collisions with rigidbody

Etek
Posts: 15
Joined: Mon Oct 04, 2010 5:55 pm

[FIXED] More elastic collisions with rigidbody

Post by Etek »

Sorry if this sounds extremely dumb.

I have a ball bouncing of unmovable obstacles (boxe shapes) and I need the ball to act more elastically when colliding head on and with great speed with these obstacles. Is there any way to do this without using the softbody component?

The only workaround I can think of right now is to apply an impulse to the ball when the collision occurs. That impulse should be perpendicular to the obstacle's surface.
Last edited by Etek on Wed Dec 22, 2010 7:48 pm, edited 1 time in total.
Etek
Posts: 15
Joined: Mon Oct 04, 2010 5:55 pm

Re: More elastic collisions with rigidbody

Post by Etek »

For example, how can one make the ball from the example below be more bouncy?
http://bulletphysics.org/mediawiki-1.5. ... ello_World
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: More elastic collisions with rigidbody

Post by Flix »

Etek wrote:I have a ball bouncing of unmovable obstacles (boxe shapes) and I need the ball to act more elastically when colliding head on and with great speed with these obstacles. Is there any way to do this without using the softbody component?

The only workaround I can think of right now is to apply an impulse to the ball when the collision occurs. That impulse should be perpendicular to the obstacle's surface.
Well, if that workaround works, just keep it...

Bounciness is controlled through the restitution factor of the two colliding bodies. As far as I remember by default the combined restitution is the product of the restitutions of the two bodies (I don't remember if it's clamped to 1.0 or not).
Through a custom material callback it's possible to override the Bullet friction and restitution responses (there must be a demo showing how to do it inside the Bullet library). You may try this approach as an alternative to your walkaround and choose the best solution.
Etek
Posts: 15
Joined: Mon Oct 04, 2010 5:55 pm

Re: More elastic collisions with rigidbody

Post by Etek »

Thanks, wouldn't btRigidBody myBody->setRestitution(value) work without making callbacks?
Etek
Posts: 15
Joined: Mon Oct 04, 2010 5:55 pm

Re: [FIXED] More elastic collisions with rigidbody

Post by Etek »

setRestitution does the trick, both objects involved must have a value set, other than the default.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: [FIXED] More elastic collisions with rigidbody

Post by Flix »

Etek wrote:wouldn't btRigidBody myBody->setRestitution(value) work without making callbacks?
Yes, the callback is needed only if you want to change the way the combined restitution is calculated from the restitutions of the two bodies.
Etek wrote:setRestitution does the trick, both objects involved must have a value set, other than the default.
Glad it worked :)
Etek
Posts: 15
Joined: Mon Oct 04, 2010 5:55 pm

Re: [FIXED] More elastic collisions with rigidbody

Post by Etek »

Thanks :D