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.
[FIXED] More elastic collisions with rigidbody
-
- Posts: 15
- Joined: Mon Oct 04, 2010 5:55 pm
[FIXED] More elastic collisions with rigidbody
Last edited by Etek on Wed Dec 22, 2010 7:48 pm, edited 1 time in total.
-
- Posts: 15
- Joined: Mon Oct 04, 2010 5:55 pm
Re: More elastic collisions with rigidbody
For example, how can one make the ball from the example below be more bouncy?
http://bulletphysics.org/mediawiki-1.5. ... ello_World
http://bulletphysics.org/mediawiki-1.5. ... ello_World
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: More elastic collisions with rigidbody
Well, if that workaround works, just keep it...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.
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.
-
- Posts: 15
- Joined: Mon Oct 04, 2010 5:55 pm
Re: More elastic collisions with rigidbody
Thanks, wouldn't btRigidBody myBody->setRestitution(value) work without making callbacks?
-
- Posts: 15
- Joined: Mon Oct 04, 2010 5:55 pm
Re: [FIXED] More elastic collisions with rigidbody
setRestitution does the trick, both objects involved must have a value set, other than the default.
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: [FIXED] More elastic collisions with rigidbody
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:wouldn't btRigidBody myBody->setRestitution(value) work without making callbacks?
Glad it workedEtek wrote:setRestitution does the trick, both objects involved must have a value set, other than the default.

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