How to update physic body

Hi, Im new to Corona.

How could I update a physic body property?.. Imagine that I have a bouncing ball with physics, with a bounce of 0.5… but if I click a button, how could I update the bounce to 1?

Thanks for your attention

Hi @george11,

After you create a physics body, there are some properties you can not change, for example bounce, friction, and density. In this case, you can do two things:

  1. remove and re-create the physics body with the new propertie(s).

  2. use the pre-collision “physics contact” to change the properties of the object for one specific collision, for example, you can change the bounce to 1 or 0 on the “upcoming collision” if you need to. Here’s a tutorial on it:

http://www.coronalabs.com/blog/2012/11/27/introducing-physics-event-contact/

Hope this helps,

Brent Sorrentino

Hi @george11,

After you create a physics body, there are some properties you can not change, for example bounce, friction, and density. In this case, you can do two things:

  1. remove and re-create the physics body with the new propertie(s).

  2. use the pre-collision “physics contact” to change the properties of the object for one specific collision, for example, you can change the bounce to 1 or 0 on the “upcoming collision” if you need to. Here’s a tutorial on it:

http://www.coronalabs.com/blog/2012/11/27/introducing-physics-event-contact/

Hope this helps,

Brent Sorrentino