Dynamic restitution

User avatar
sinoth
Posts: 13
Joined: Tue Apr 07, 2009 8:27 pm
Location: USA

Dynamic restitution

Post by sinoth »

Heya all, still learning the library so please be gentle if I've overlooked something :)

I have a dynamic rigid body sphere that the player controls (through forces). I want the player to be able to toggle whether or not the sphere bounces off surfaces. It seems to me that I need to be able to change the restitution of its btRigidBody, but from what I can tell this isn't possible. Restitution is set once in the btRigidBody CI and not available to modify later.

Is there some other way to fake this effect or will I have to do something like create two rigid bodies and swap them out when the user toggles the 'bouncy' mode?
ShortyTwoMeters
Posts: 5
Joined: Sat Apr 04, 2009 7:25 am

Re: Dynamic restitution

Post by ShortyTwoMeters »

btCollisionObject (from which btRigidBody derives) has a function setRestitution(). Good luck with your project!
User avatar
sinoth
Posts: 13
Joined: Tue Apr 07, 2009 8:27 pm
Location: USA

Re: Dynamic restitution

Post by sinoth »

Haha, sigh. Thanks Shorty, not sure how I missed something so obvious :) Works like a charm. I need to stop assuming that if it doesn't show up in Code::Blocks code completion then it doesn't exist...