physics.setAverageCollisionPositions()

Type Function
Library physics.*
Return value none
Revision Release 2024.3703
Keywords physics, collision, averaging
See also physics.getAverageCollisionPositions()
collision
preCollision
postCollision
physics.setReportCollisionsInContentCoordinates()

Overview

Because it’s common for Box2D to report multiple collision points during a single frame iteration, this setting is useful to report those points as one averaged point. This function applies to all the contact points in the collision, preCollision, and postCollision physics events.

Syntax

physics.setAverageCollisionPositions( enabled )
enabled (required)

Boolean. Enables the averaging of all contact points in a collision between physics bodies.

Example

-- Toggle the averaging
if ( physics.getAverageCollisionPositions() ) then

    physics.setAverageCollisionPositions( false )
else

    physics.setAverageCollisionPositions( true )
end