Type Boolean
Object PhysicsContact
Library physics.*
Revision 2017.3113
Keywords physics contact, isEnabled
See also preCollision


Enable or disable the collision associated with this contact. This is typically used inside a preCollision event listener and may be used to construct one-sided platforms that the character can jump vertically through, but only from below.


The contact is only enabled/disabled for the current time step. Future contacts will be registered as usual.


local platform = display.newRect( 0, 0, 280, 30 )
platform.x, platform.y = display.contentCenterX, display.contentCenterY+80
platform.collType = "passthru"
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 preCollisionEvent( self, event )

   local collideObject = event.other
   if ( collideObject.collType == "passthru" ) then = false  --disable this specific collision

ball.preCollision = preCollisionEvent
ball:addEventListener( "preCollision" )