← Documentation Home

PhysicsCollisionCount

Category: 2D Game Physics (Pro)

Back to System Functions


Signature

PhysicsCollisionCount(world As Integer)

Returns

Integer

Description

Returns the number of body pairs recorded during the most recent physics step.

Performance and behavior

Collision indices are zero-based and remain valid until the next physics step. Recording is capped at 65,536 pairs per step to bound memory use; every detected contact is still resolved.

Pro feature: compiling code that uses this function requires a license with the GamePhysics feature enabled.

Example

For i = 0 To PhysicsCollisionCount(world) - 1
    DebugPrint Str(PhysicsCollisionBodyA(world, i))
Next