← Back to Docs
  • index.html
  • Clayground
  • Clayground.Behavior
  • FollowPath
  • Clayground 2025.2
  • FollowPath QML Type

    Makes an entity follow a predefined path of waypoints. More...

    Import Statement: import Clayground.Behavior

    Properties

    Signals

    Detailed Description

    FollowPath moves an actor through a sequence of waypoints using physics-based movement. It supports looping paths and provides debug visualization for development.

    Example usage:

    import Clayground.Behavior
    
    RectBoxBody {
        id: guard
    
        FollowPath {
            world: theWorld
            wpsWu: [
                Qt.point(5, 5),
                Qt.point(10, 5),
                Qt.point(10, 10),
                Qt.point(5, 10)
            ]
            repeat: true
            running: true
            debug: true
        }
    }

    See also MoveTo.

    Property Documentation

    actor : var

    The entity to move (defaults to parent).


    debug : bool

    Show debug visualization of waypoints and path.


    debugColor : color

    Color for debug visualization.


    repeat : bool

    Loop back to the first waypoint when path completes.


    running : bool

    Whether path following is active.


    world : ClayWorld2d [required]

    The world context (required).


    wpsWu : list

    Array of waypoints in world units.

    Each waypoint should be a Qt.point(x, y) object.


    Signal Documentation

    arrived()

    Emitted when the actor completes the path (when repeat is false).

    Note: The corresponding handler is onArrived.