Moves an actor entity to a specified destination using physics. More...
| Import Statement: | import Clayground.Behavior |
| Inherits: |
MoveTo provides physics-based movement of an entity toward a target position. It uses velocity adjustments to smoothly move the actor and detects arrival using collision sensors.
Example usage:
import Clayground.Behavior RectBoxBody { id: enemy MoveTo { world: theWorld destXWu: player.xWu destYWu: player.yWu running: true desiredSpeed: 3 onArrived: console.log("Reached target!") } }
actor : var |
The entity to move (defaults to parent).
debug : bool |
Show debug visualization of destination.
debugColor : color |
Color for debug visualization (default: "lightblue").
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.
running : bool |
Whether movement is active.
world : ClayWorld2d |
The world context (required).
arrived() |
Emitted when the actor reaches the destination.
Note: The corresponding handler is onArrived.