Type Number Event collision Revision 2017.3060 Keywords collision, x See also event.y
The x position where the collision event occurred. Note that the reported collision position can be influenced by physics.getAverageCollisionPositions() and physics.setReportCollisionsInContentCoordinates().
During the "ended"
phase, the x and y positions are always zero. This is a Box2D limitation.
When a collision involves a circle and the collision result is returned in local space (see physics.setReportCollisionsInContentCoordinates()), the local space position of the collision is always 0,0
. This is a Box2D limitation.
local function onCollision( event ) if ( event.phase == "began" ) then print( "began: " .. event.object1 .. " & " .. event.object2 ) print( "position: " .. event.x .. "," .. event.y ) elseif ( event.phase == "ended" ) then print( "ended: " .. event.object1 .. " & " .. event.object2 ) print( "position: " .. event.x .. "," .. event.y ) end end