physics.getAverageCollisionPositions()

Type Function
Library physics.*
Return value Boolean
Revision Release 2022.3683
Keywords physics, collision, averaging
See also physics.setAverageCollisionPositions()
collision
preCollision
postCollision
physics.getReportCollisionsInContentCoordinates()

Overview

It's common for Box2D to report multiple contact points during a single iteration of a simulation. This function is use to determine if averaging of all the contact points is enabled.

This function returns false (default) if the point of contact reported is the first one reported by Box2D (the order is arbitrary). This function returns true if the point of contact reported is the average of all the contact points.

Syntax

physics.getAverageCollisionPositions()

Example

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

    physics.setAverageCollisionPositions( false )
else

    physics.setAverageCollisionPositions( true )
end