← Back to Docs
  • index.html
  • Clayground
  • Clayground.Physics
  • CircleBody
  • Clayground 2026.7
  • CircleBody QML Type

    Circle-shaped physics body with visual representation. More...

    Import Statement: import Clayground.Physics

    Detailed Description

    CircleBody combines a round visual with a Box2D circle fixture. Unlike a box fixture it has no corners to snag on, which is what makes it the collider of choice for characters and projectiles moving along walls.

    xWu and yWu address the bounding box's corner, exactly as they do for RectBoxBody - not the circle's centre. The centre sits radiusWu away from both.

    Example usage:

    import Clayground.Physics
    import Box2D
    
    CircleBody {
        xWu: 5; yWu: 5
        radiusWu: 0.5
        color: "red"
        bodyType: Body.Dynamic
        density: 1
        friction: 0.3
        restitution: 0.5
    }

    Properties

    Radius in world units. Drives both the fixture and the visual.

    The Box2D circle fixture.

    Fill color of the circle.

    Border properties of the circle.

    Fixture density affecting mass.

    Friction coefficient (0-1).

    Bounciness coefficient (0-1).

    If true, detects collisions without physical response.

    Collision category bits.

    Collision mask bits.

    Collision group index.