physics.setReportCollisionsInContentCoordinates()

Type Function
Library physics.*
Return value none
Revision Release 2024.3703
Keywords physics, collision, content, space, coordinates
See also physics.getReportCollisionsInContentCoordinates()
collision
preCollision
postCollision
physics.setAverageCollisionPositions()

Overview

This function sets the content origin as the collision point in the collision, preCollision, and postCollision physics events.

Syntax

physics.setReportCollisionsInContentCoordinates( enabled )
enabled (required)

Boolean. Sets the physics engine to return the specific collision point between two bodies, in content coordinates. This means that when two bodies collide, the event.x and event.y reported to the collision listener will equate to the exact point where collision occurred.

Example

-- Toggle the collision point.
if ( physics.getReportCollisionsInContentCoordinates() ) then

    physics.setReportCollisionsInContentCoordinates( false )

else

    physics.setReportCollisionsInContentCoordinates( true )

end