Movement and input reference
The mover, path providers, movement executors and click input on a unit, and the seams for your own pathfinding and movement backend. For how to use it, see Movement and input.
VtTopDownClickToMove
Component. Add it with Add Component → Vantage → Movement → VtTopDownClickToMove.
Moves a unit to a destination: MoveTo asks the path provider for waypoints, follows them with acceleration, turning, stuck recovery and gravity, and writes the position through the unit’s IVtMovementExecutor. Player input, AI and abilities all move units through it.
Scripting API
| Member | Description |
|---|---|
bool IsMoving { get; } |
True while actively following a path. |
float MeasuredSpeed { get; } |
Most recent measured horizontal velocity magnitude (u/s). Updated every frame. |
float MoveSpeed { get; set; } |
Read/write: the configured top speed. Setting mid-move is respected the next frame. This is the base value; live modifiers on VtCoreStats.moveSpeed stack on top — see EffectiveMoveSpeed. |
float SpeedMultiplier { get; set; } |
Multiplier on top of EffectiveMoveSpeed. AI sets it to stroll or sprint; 1 is normal. |
float EffectiveMoveSpeed { get; } |
The effective top speed for this frame — base MoveSpeed composed with flat + percent modifiers on VtCoreStats.moveSpeed via VtUnitModifiers.Apply. Haste buffs, boots of flight, slow debuffs all land here. Never negative. |
float Acceleration { get; } |
How fast the unit reaches top speed, in world units per second squared. Read-only here: it is Acceleration on the tuning asset and applies to every unit. |
float RotationSpeed { get; } |
How fast the unit turns toward its movement direction, in degrees per second. Read-only here: it is Rotation Speed on the tuning asset and applies to every unit. |
IVtPathProvider PathProvider { get; set; } |
The active path provider, or null if none is attached. Assigning swaps the backend live. |
IReadOnlyList<Vector3> CurrentPath { get; } |
Read-only view of the current waypoint list for debugging / visualization. |
event Action OnArrived |
Fires once per MoveTo when the path finishes — whether by arriving, giving up on stuck, or running out of waypoints. Does not fire when Stop cancels movement or when an unreachable path is rejected outright. |
event Action<float> OnMeasuredSpeedChanged |
Fires every frame with the agent’s actual (measured) horizontal velocity magnitude. Subscribe this from an Animator binding, footstep/audio system, dust VFX, etc. — the movement component itself knows nothing about presentation. |
void MoveTo(Vector3 destination, Action onArrived = null, bool acceptPartialPath = false) |
Request a path to destination and start following it. Replaces any path currently being followed; any in-flight path request is invalidated and its callback discarded. |
void Stop() |
Cancel the current path and any pending path request. The persistent OnArrived event does NOT fire (cancellation is not arrival). |
void Teleport(Vector3 position) |
Teleport the agent to a new world position and cancel any in-flight movement. Use this when respawning, loading a save, or warping — after a teleport the animator’s measured speed will not spike because we resynchronize the previous-position sample. |
VtNavMeshPathProvider
Component. Add it with Add Component → Vantage → Movement → VtNavMeshPathProvider.
IVtPathProvider backed by Unity’s built-in NavMesh. Add it next to VtTopDownClickToMove and bake a NavMesh with the AI Navigation package; no other setup is needed. Requests are answered synchronously.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Sample Radius (sampleRadius) |
float |
1.5 | ≥ 0.01 | How far (world units) the start and destination may be from the NavMesh and still snap onto it. Covers units standing on small props and clicks slightly past a mesh edge. |
Area Mask (areaMask) |
int |
-1 | NavMesh area mask for path queries. -1 = every area. Use the same mask as the agent type you baked for. | |
Fallback To Straight Line (fallbackToStraightLine) |
bool |
On | When the unit is not on any NavMesh (usually: nothing baked yet), walk a straight line and log a warning once instead of refusing to move. | |
Max Path Queries (maxPathQueries) |
int |
4 | ≥ 1 | Most path searches one request may run. When a search stops short of a reachable goal because it ran out of budget, the next one continues from where it stopped. 1 turns continuation off. |
Scripting API
| Member | Description |
|---|---|
void RequestPath(Vector3 from, Vector3 to, Action<List<Vector3>> onComplete) |
Find a NavMesh path from from to to and call onComplete at once with its corners, or with null when there is no path. |
VtTopDownClickInput
Component. Add it with Add Component → Vantage → Movement → VtTopDownClickInput. Adds VtTopDownClickToMove automatically.
Player click input. The Command action (right-click by default) attacks a hostile under the pointer, walks to an item or NPC and interacts with it, and otherwise moves the unit to the ground point.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Click Mask (clickMask) |
LayerMask |
Everything | Layers the click raycast considers. Include the ground and every layer your attackable units, items and NPCs sit on. Everything works for a quick start; narrow it in a real project. | |
Ground Mask (groundMask) |
LayerMask |
Everything | Layers a move order can land on. When the click hits nothing to attack or pick up, the unit walks to the point where the ray meets these layers. | |
Ray Distance (rayDistance) |
float |
500 | ≥ 1 | Max raycast distance, in world units. |
Spawn Move Marker (spawnMoveMarker) |
bool |
On | Show a short ring on the ground where a move order lands. | |
Command Action (commandAction) |
InputActionReference |
None | Moves, attacks or picks up at the pointer. Empty uses Command from the Vantage input actions, the right mouse button by default. | |
Debug Logs (debugLogs) |
bool |
Off | Log every command press to the Console: what the ray hit, whether it can be attacked or picked up, the hostility check and whether the press attacked, picked up, moved or did nothing. Use it when clicking something does nothing. Leave off in builds. |
VtTopDownAnimatorBinding
Component. Add it with Add Component → Vantage → Movement → VtTopDownAnimatorBinding. Adds VtTopDownClickToMove automatically.
Subscribes to VtTopDownClickToMove.OnMeasuredSpeedChanged and writes the value to a float parameter on an Animator. Keeps movement and presentation in separate components so the core movement script stays animation-system agnostic.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Animator (animator) |
Animator |
None | Animator that receives the speed parameter. Empty uses the first Animator on this object or its children. |
Speed Parameter (speedParameter) |
string |
"Speed" |
Name of the float parameter on the Animator fed with the measured speed. |
VtLocalMovementExecutor
Component. Add it with Add Component → Vantage → Movement → VtLocalMovementExecutor. Adds CharacterController automatically.
The single-player IVtMovementExecutor: moves the unit’s CharacterController directly and reports whether it is grounded. VtTopDownClickToMove adds it when the unit has no executor.
Scripting API
| Member | Description |
|---|---|
bool IsGrounded { get; } |
True while the CharacterController touches the ground. |
void Move(Vector3 displacement) |
Move the CharacterController by displacement this frame, sliding along collisions. |
void Teleport(Vector3 position) |
Put the unit at position at once, without sliding or collisions. |
VtClientAuthMovementExecutor
Component. Add it with Add Component → Vantage → Movement → VtClientAuthMovementExecutor. Adds CharacterController automatically.
Client-authoritative IVtMovementExecutor backend — each unit is owned by exactly one client, and the owner’s inputs drive its position. Non-owners receive the position via a separate replication layer (typically a NetworkTransform component from Netcode for GameObjects, Mirror, FishNet, etc. — attached as a sibling on the prefab).
Scripting API
| Member | Description |
|---|---|
bool IsGrounded { get; } |
True while the CharacterController touches the ground. On other clients it reflects the replicated position and is only good for visuals. |
void Move(Vector3 displacement) |
Move the CharacterController by displacement this frame on the owning client. Does nothing on other clients, which receive the position by replication. |
void Teleport(Vector3 position) |
Put the unit at position at once on the owning client. Other clients receive the new position by replication. |
VtPredictedMovementExecutor
Component. Add it with Add Component → Vantage → Movement → VtPredictedMovementExecutor. Adds CharacterController automatically.
Movement executor for server-authoritative games. The server moves the unit and its position is the truth; the owning client moves at once and corrects toward the server’s position when they drift apart; every other client follows the server’s position smoothly.
Scripting API
| Member | Description |
|---|---|
Vector3 AuthoritativePosition { get; } |
The last position the authority reported, or this transform’s position before any arrived. |
bool HasAuthoritativePose { get; } |
True once ApplyAuthoritativePose has been called. |
Vector3 PendingCorrection { get; } |
Correction a predicting client still has to apply, on the ground plane. Zero when in agreement. |
bool IsGrounded { get; } |
True while the CharacterController touches the ground. |
event Action<float> OnReconciled |
Fires on a predicting client when a correction starts. Arg: the planar error that triggered it. |
void Tick(float deltaTime) |
Advance replica smoothing and any pending correction. The authority does nothing here. |
void Move(Vector3 displacement) |
Move the CharacterController by displacement this frame on the server and the owning client. Does nothing on other clients, which follow the server’s position. |
void Teleport(Vector3 position) |
Put the unit at position at once on the server and the owning client, dropping any pending correction. |
void ApplyAuthoritativePose(Vector3 position, Quaternion rotation) |
Feed the authority’s latest position and rotation. A predicting client starts a correction when the planar error exceeds the reconcile threshold; a replica starts following; the authority itself ignores the call. |
VtMoveMarker
Component.
A brief green ring on the ground that expands and fades out, to confirm a move order. Call Spawn with the destination; the ring removes itself after 0.8 seconds. Click input and orders show it when their Spawn Move Marker option is on.
Scripting API
| Member | Description |
|---|---|
static GameObject Spawn(Vector3 position) |
Spawn a move marker at the given world position. The returned GameObject destroys itself automatically — callers don’t need to track or clean up the instance. |
IVtPathProvider
Interface. Implemented by VtNavMeshPathProvider.
Pathfinding seam for VtTopDownClickToMove. The package ships VtNavMeshPathProvider for Unity’s NavMesh; implement this interface to plug in A* Pathfinding Project, a grid, or a waypoint graph. Without any provider the mover walks a straight line.
Scripting API
| Member | Description |
|---|---|
void RequestPath(Vector3 from, Vector3 to, Action<List<Vector3>> onComplete) |
Request a path from from to to. The implementation must call onComplete exactly once with the resulting waypoint list, or with null on failure. |
IVtMovementExecutor
Interface. Implemented by VtClientAuthMovementExecutor, VtLocalMovementExecutor, VtPredictedMovementExecutor.
Writes a unit’s position for VtTopDownClickToMove. One executor sits on each moving unit; swap the component on the prefab to switch between single-player, co-op and server-authoritative movement without changing anything that calls VtTopDownClickToMove.MoveTo. Implement it for your own movement backend.
Scripting API
| Member | Description |
|---|---|
bool IsGrounded { get; } |
True when the agent is currently grounded. Used by the caller to decide whether to fold gravity into the next Move call. |
void Move(Vector3 displacement) |
Apply a per-frame world-space displacement (horizontal + gravity already folded in by the caller). Implementations may slide along collisions, replicate, or queue the input for reconciliation. |
void Teleport(Vector3 position) |
Hard-set the world position, cancelling any in-flight physics / phantom velocity. Use for respawn, load, scripted warps. Implementations must ensure the position write is immediately observable on the caller’s next frame. |
IVtPointerBlocker
Interface. Implemented by VtAbilityHotkeys, VtBuildInput, VtOrderInput.
A component that owns mouse clicks for a moment, such as aiming a ground ability or picking an attack-move point. Click input, selection and orders on the same object ignore the pointer while any other blocker there reports true. See VtPointerBlockers.IsBlocked.
Scripting API
| Member | Description |
|---|---|
bool BlocksPointerThisFrame { get; } |
True while this component owns the pointer, and on the frame it let go. |
VtPathStitcher
Static class.
Joins partial path queries into one path. Path searches give up after a fixed budget and return the path to the closest point they reached; on a large map that point can sit halfway to the goal. The stitcher queries again from there until the goal is reached, a query stops getting closer, or the query budget runs out. Pure C#, so any IVtPathProvider can use it with its own query.
Scripting API
| Member | Description |
|---|---|
static bool Stitch(Vector3 from, Vector3 to, VtPathStitcher.Query query, int maxQueries, float minProgress, List<Vector3> result) |
Build a path from from to to into result, calling query at most maxQueries times. A continuation that ends less than minProgress closer to the goal (on the ground plane) than the previous end counts as unreachable: it is dropped and the partial path so far is returned. Returns false only when the first query finds no path. |
VtPointerBlockers
Static class.
Asks the IVtPointerBlocker components on an object whether the pointer is taken.
Scripting API
| Member | Description |
|---|---|
static bool IsBlocked(Component asker) |
True when a blocker on the object of asker, other than the asker itself, blocks the pointer this frame. |