2D Movement
In a 2D Scene, world motion uses metres and velocity uses metres per second. Positive X points right and positive Y points up. A movement Action controls the selected live Object; its effect depends on the Action, supplied values, and any other Logic or physics affecting that Object.
Choose the Operation
| Requirement | Operation | Behavior |
|---|---|---|
| Request an exact horizontal or vertical speed | Set Velocity | Replaces each supplied velocity axis; a blank axis preserves its current speed |
| Move immediately to a position | Set Position | Resolves the selected coordinate space and changes position immediately |
| Apply a single physical push | Apply Impulse | Applies a mass-aware impulse; an off-centre push can also produce rotation when enabled |
Setting a position and requesting motion have different meanings. A teleport places the Object at a destination immediately. Velocity describes ongoing motion. An impulse changes motion according to the body’s physics settings. Use velocity when you need an exact requested speed.
Set Both Axes Explicitly
Select Set Velocity from Movement and Physics > Motion in the Action picker. Choose the intended target in Applies To. For Logic attached to the moving Object, SELF selects the live owner of that attachment.
For horizontal motion at three metres per second, use:
| Field | Value | Meaning |
|---|---|---|
| Applies To | SELF | Change the instance running this Logic |
| X Velocity | 3 |
Request rightward motion at three metres per second |
| Y Velocity | 0 |
Clear vertical motion |
A blank Y field preserves the current vertical velocity. It does not mean zero. Likewise, setting only Y can preserve horizontal motion. Supply zero for an axis when the operation must stop that axis.
The Event determines when the request occurs. A Create Event can establish an initial velocity. An input Event can replace velocity as a command changes. Separate event-driven velocity requests from any continuous physics or additional movement Logic that can modify the result.
Connect Player Input
A 2D Axis Command supplies a direction vector. Use the Event’s typed values to calculate velocity from a Number speed:
X Velocity: event.axisVector.x * speedY Velocity: event.axisVector.y * speedDeclare speed as a compatible Number Parameter or variable before using it in the expression. Configure the command and select it in the 2D Axis Input Event as described in Player Commands and Input. The Event’s neutral vector allows the same Action to set both axes to zero when input is released.
Velocity already expresses distance per second. Do not multiply the requested speed by frame delta. At the default image scale of 32 pixels per metre, three metres per second corresponds to 96 pixels of equivalent motion per second; the authored velocity remains 3. See World Units and Image Scale.
Add Contact Behavior Deliberately
Simple non-physical motion does not require a Collider. Add Collider geometry when contact detection or physical response is part of the mechanic. Inspect both Colliders’ geometry and physics settings, then test contact in play.
Gravity, fixed-body settings, and other physics configuration can change the observed motion. A top-down movement request and a falling physical body require different configurations. See Collision and 2D Physics for trigger and solid interactions.
For an Object that must find a route around obstacles or follow a moving target, use Navigation and pathfinding. For a platform game’s machine-controlled player, use Platformer Logic and its tile-to-world conversion rules.
An Object can leave the camera’s view while continuing to move. Define a boundary, wrap, stop, or camera-follow rule when the game requires one; a velocity request alone does not establish that rule.
Diagnose Unexpected Motion
| Symptom | Check |
|---|---|
| No motion | Confirm that the Event fires, the attachment is enabled, the target is live, and supplied axes are nonzero |
| Motion changes the wrong Object | Inspect Applies To and the live Object reference; SELF belongs to the current attachment |
| Vertical drift during horizontal movement | Supply Y Velocity 0 when stopping vertical motion is intended; inspect gravity and other movement Logic |
| Motion continues after input release | Confirm the neutral input Event reaches the Action and sets both axes to zero |
| Speed is unexpectedly large | Check metre-based values, camera framing, and whether a pixel speed was entered as a world speed |
| A velocity request is immediately replaced | Inspect later Actions, other Events, attached Logic, and physical interactions affecting the same instance |
Test from a fresh run when comparing authored defaults. Check positive, negative, and zero values separately, then test input returning to neutral and any relevant contact. Pause and resume preserve the current runtime state; they do not recreate the initial conditions.
Myth Engine Documentation
