Can we change physics body properties in runtime

Hai, Can we change physics body properties in runtime. My code is

local ground = display.newImage( “ground.png” )

ground.x = 160; ground.y = 445

physics.addBody( ground, “static”, { friction=0.5, bounce=0.3 } )

I want to change the bounce value need to 1.0 in run time, is it possible… 

Can any one help me

Hello @kripa1415,

You can’t directly change the body properties after creation, but you can change the properties of an individual collision using a pre-collision PhysicsContact handler. This tells the system that when the collision occurs, you wish to change the “bounce” value to something else, for that collision only.

This tutorial and the API documents should explain it better:

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

http://docs.coronalabs.com/api/event/preCollision/index.html

http://docs.coronalabs.com/api/type/PhysicsContact/bounce.html

Take care,

Brent

Hello @kripa1415,

You can’t directly change the body properties after creation, but you can change the properties of an individual collision using a pre-collision PhysicsContact handler. This tells the system that when the collision occurs, you wish to change the “bounce” value to something else, for that collision only.

This tutorial and the API documents should explain it better:

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

http://docs.coronalabs.com/api/event/preCollision/index.html

http://docs.coronalabs.com/api/type/PhysicsContact/bounce.html

Take care,

Brent