← Back to Docs
  • index.html
  • Clayground
  • Clayground.Behavior
  • NavigateTo
  • Clayground 2026.2
  • NavigateTo QML Type

    Obstacle-aware navigation combining GridPathfinder with FollowPath. More...

    Import Statement: import Clayground.Behavior

    Properties

    Signals

    Detailed Description

    NavigateTo converts world-unit destinations to grid coordinates, computes a path using A*, and feeds the resulting waypoints to FollowPath for physics-based movement. It periodically recalculates the path to handle moving targets.

    Example usage:

    import Clayground.Behavior
    
    RectBoxBody {
        id: enemy
    
        NavigateTo {
            world: theWorld
            pathfinder: levelPathfinder
            destXWu: player.xWu
            destYWu: player.yWu
            cellSize: 2
            running: true
            desiredSpeed: 3
            recalcInterval: 500
            onArrived: console.log("Reached target!")
        }
    }

    See also FollowPath, MoveTo, and GridPathfinder.

    Property Documentation

    actor : var

    The entity to move (defaults to parent).


    cellSize : real

    World units per grid cell (default: 1).


    debug : bool

    Show debug visualization of path.


    debugColor : color

    Color for debug visualization.


    desiredSpeed : real

    Movement speed in world units per second (default: 2).


    destXWu : real

    Destination X coordinate in world units.


    destYWu : real

    Destination Y coordinate in world units.


    pathfinder : GridPathfinder [required]

    The pathfinder instance to use for computing paths (required).


    recalcInterval : int

    Milliseconds between path recalculations (default: 500).


    running : bool

    Whether navigation is active.


    world : ClayWorld2d [required]

    The world context (required).


    Signal Documentation

    arrived()

    Emitted when the actor reaches the destination.

    Note: The corresponding handler is onArrived.