[RESOLVED] How to disable bounce?

Hello,
 
Easy problem short, how do I disable a bounce?
 
I have made this but it complains that the line "self.box1.bodyType = “static” " is wrong and I haven’t found an answer after a long research. My idea was that I change the falling objects bodytype to static when the collision happens so that it would not bounce. Hopefully I will get an answer!

local physics = require “physics”
physics.start()
local box1 = display.newImage( “hugeBox1.png” )
physics.addBody( box1, “dynamic”, { density = 1.0, friction = 0.3,
bounce = 0.2 } )
box1.myName = “Box 1”
local box2 = display.newImage( “hugeBox2.png”, 0, 350)
physics.addBody( box2, “static”, { density = 1.0, friction = 0.3,
bounce = 0.2 } )
box2.myName = “Box 2”
local function onCollision( self, event )
if event.phase == “began” and self.myName == “Box 1” then
self.box1.bodyType = “static”
end
end
box1.collision = onCollision
box1:addEventListener( “collision”, box1 )
box2.collision = onCollision
box2:addEventListener( “collision”, box2 )
 
Edit: of course after spending 5 hours to get the answer, I found it right away after posting this topic…
 
If somebody is having the same problem as I am, the code needed is:

event.contact.bounce = false
 

and the bounce is “literally” enabled.

I believe you can’t change a bodytype during a collision event:

from the SDK on physics found here:  http://docs.coronalabs.com/guide/physics/physicsBodies/index.html#object.bodytype

object.bodyType

object.bodyType is a string value for the type of physical body. Possible values include dynamic, static, or kinematic. See the Body Type section for details. Note that you cannot change the body type during a collision event, so you must queue this event after a slight, imperceptible delay:

local function onCollisionDelay()
–change the body type
object.bodyType = “kinematic”
end

timer.performWithDelay( 10, onCollisionDelay )

I believe you can’t change a bodytype during a collision event:

from the SDK on physics found here:  http://docs.coronalabs.com/guide/physics/physicsBodies/index.html#object.bodytype

object.bodyType

object.bodyType is a string value for the type of physical body. Possible values include dynamic, static, or kinematic. See the Body Type section for details. Note that you cannot change the body type during a collision event, so you must queue this event after a slight, imperceptible delay:

local function onCollisionDelay()
–change the body type
object.bodyType = “kinematic”
end

timer.performWithDelay( 10, onCollisionDelay )