Type Number Event collision Revision Release 2022.3683 Keywords collision, y See also event.x
The y position where the collision event occurred. Note that the reported collision position can be influenced by physics.setAverageCollisionPositions() and physics.setReportCollisionsInContentCoordinates().
During the "ended"
phase, this value will always be 0
. This is a Box2D limitation.
If either (or both) bodies involved in the collision are sensors, this value will always be 0
. 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