Can I change a physics body's bounce property?

I want to change the bounce property of an existing physics body. I have coins bouncing around pretty good on the screen with bounce set greater than 1:

physics.addBody( coin, { density=1.0, friction=0.1, bounce=1.1, radius = 20 } )  

After the user does something I want the coins to settle down and not bounce so much.

Is that possible?

Thanks for your help. [import]uid: 27976 topic_id: 30224 reply_id: 330224[/import]

– [import]uid: 75779 topic_id: 30224 reply_id: 121074[/import]

Hi there,

No, unfortunately, to my knowledge it’s not possible to change a physics object’s bounce property (or density, friction, or collision filter, for that matter) after it’s been created. Your best bet is to destroy the physics body and immediately create a new one with the new properties in its place, copying over not only its position, but also its linear and angular velocity so that the switch appears seamless.

  • Andrew [import]uid: 109711 topic_id: 30224 reply_id: 121098[/import]

Ok, thanks for the info, and workaround tip. [import]uid: 27976 topic_id: 30224 reply_id: 121099[/import]

– [import]uid: 75779 topic_id: 30224 reply_id: 121074[/import]

Hi there,

No, unfortunately, to my knowledge it’s not possible to change a physics object’s bounce property (or density, friction, or collision filter, for that matter) after it’s been created. Your best bet is to destroy the physics body and immediately create a new one with the new properties in its place, copying over not only its position, but also its linear and angular velocity so that the switch appears seamless.

  • Andrew [import]uid: 109711 topic_id: 30224 reply_id: 121098[/import]

Ok, thanks for the info, and workaround tip. [import]uid: 27976 topic_id: 30224 reply_id: 121099[/import]