Type PhysicsContact Event collision Revision Release 2022.3683 Keywords collision, contact
During a collision, there are multiple contact points that occur. You can manipulate these contact points to create certain effects.
You should not hold onto the contact object. It is only valid in the scope of your collision listener.
event.contact.isTouching
— indicates whether the two objects are touching event.contact.bounce
— specifies the bounce factor of the collision event.contact.friction
— specifies the friction factor of the collision event.contact.tangentSpeed
— specifies the tangential speed ("conveyer belt" motion) along the collision surface, 0 by default local platform = display.newRect( 0, 0, 280, 30 ) platform.surfaceType = "superbounce" platform.x, platform.y = display.contentCenterX, display.contentCenterY+80 physics.addBody( platform, "static", { bounce=0.0, friction=0.3 } ) local ball = display.newCircle( 0, 0, 15 ) ball.x, ball.y = display.contentCenterX, display.contentCenterY-40 physics.addBody( ball, "dynamic", { bounce=0.0, radius=20 } ) local function onCollision( self, event ) local collideObject = event.other if ( collideObject.surfaceType == "superbounce" ) then event.contact.bounce = 20 -- Magnify bounce for this specific collision end end ball.collision = onCollision ball:addEventListener( "collision" )