← Back to Docs
  • index.html
  • Clayground
  • Clayground.Physics
  • CollisionTracker
  • Clayground 2025.2
  • CollisionTracker QML Type

    Tracks entities currently colliding with a fixture. More...

    Import Statement: import Clayground.Physics

    Detailed Description

    CollisionTracker maintains a set of entities currently in contact with a monitored fixture and emits signals when contacts begin or end.

    Example usage:

    import Clayground.Physics
    
    CollisionTracker {
        fixture: player.fixture
        debug: true
        onBeginContact: (entity) => {
            if (entity.objectName === "ground")
                player.onGround = true
        }
        onEndContact: (entity) => {
            if (entity.objectName === "ground")
                player.onGround = false
        }
    }

    Properties

    The fixture to monitor for collisions.

    Set of entities currently in collision with the fixture.

    Shows debug visualization markers on colliding entities.

    Signals

    Emitted when an entity enters collision with the fixture.

    Emitted when an entity leaves collision with the fixture.