Move Towards
Move Towards approaches and faces an arrival location before another ability starts, or follows an independent destination from gameplay code. Keep one instance on the character; it is a controller-owned preparation helper.
Add Move Towards
- Add Move Towards under Ultimate Character Locomotion > Abilities and keep Start Type Manual.
- Order pathfinding above Move Towards and Move Towards above the waiting ability, such as Interact. With Speed Change and NavMeshAgent Movement, put Speed Change above the pathfinding ability.
- Supply Move Towards Locations from the waiting action, or configure an independent destination below.
- For obstacle-aware routing, configure NavMeshAgent Movement and a baked NavMesh. Otherwise the approach is direct.
- Match movement animation to approach speed. For faster final turning, use a Move Towards State with higher Motor Rotation Speed; the demo uses
100.
Choose destination and movement
| Route | Configuration |
|---|---|
| Before another ability | It returns locations. If none accepts the current pose, the helper selects the closest and starts the action after arrival. |
| Independent component | Assign Independent Move Towards Location and start manually. |
| Code destination | Call MoveTowardsLocation with position or position/rotation; update facing tolerance explicitly when reusing the runtime location. |

Use Offset/Yaw Offset for the pose, Size zero for precise arrival, and Distance/Angle for tolerance. Require Grounded gates floor interactions; Precision Start waits for a settled handoff. The location guide owns those settings in detail.
Input Multiplier combines with the location’s Movement Multiplier and active Speed Change. Direct movement limits final input to avoid overshooting and uses Motor Rotation Speed for facing. Pathfinding owns the route when configured; the helper still checks final arrival requirements.
With root motion, input drives the animation while the clip determines visible displacement. Use a faster matching clip rather than expecting an input multiplier alone to change embedded motion.
Configure early-stop policy
| Field | Default or decision |
|---|---|
| Inactive Timeout | 1 second without positional or rotational progress stops early. |
| Moving Target Distance Timeout | Effectively unlimited by default; limits movement from the target’s starting position. |
| Teleport On Early Stop | Enabled: places the character at target and starts the pending action. Disable to cancel blocked/stalled approaches. |
| Disable Gameplay Input | Enable for exclusive automatic approach input; ownership is released on stop. |
The helper temporarily controls independent look for final facing. Normal arrival stops owned pathfinding, restores input/look, then starts the waiting ability. A separate forced interruption cancels the pending handoff.
Verify routing and cancellation
Trigger an interaction outside its arrival pose. Move Towards (Active) should appear while the interaction waits. Confirm direct or NavMesh routing, position, grounded requirement, facing, and settling before the next animation starts.
Block the route longer than Inactive Timeout and move a target beyond its movement limit in separate tests. Confirm each follows the chosen teleport/cancel policy. Test root-motion approach, player-input ownership, and a position-only request followed by a finite-facing request.
| Symptom | Check | Fix |
|---|---|---|
| Waiting action starts misaligned | Returned location, order, tolerances | Put the helper above it and use precise authored arrival. |
| No path routing | Baked NavMesh and ability order | Configure NavMeshAgent Movement above Move Towards. |
| Overshoot or sliding | Clip speed and multipliers | Match animation and reduce input/location scaling. |
| Stops or teleports unexpectedly | Progress, timeout, target movement | Fix the obstruction/animation or choose cancellation deliberately. |
| Facing skipped after position-only call | Independent location Angle | Restore finite tolerance before the rotation request. |
Developer reference
A position-only request accepts any facing:
using UnityEngine;
using Opsive.UltimateCharacterController.Character;
using Opsive.UltimateCharacterController.Character.Abilities;
public class MyObject : MonoBehaviour
{
[Tooltip("The character that should move towards the destination.")]
[SerializeField] protected GameObject m_Character;
[Tooltip("The destination that the character should move towards.")]
[SerializeField] protected Vector3 m_Destination;
/// <summary>
/// Starts moving to the destination.
/// </summary>
private void Start()
{
var characterLocomotion = m_Character.GetComponent<UltimateCharacterLocomotion>();
characterLocomotion.MoveTowardsAbility.MoveTowardsLocation(m_Destination);
}
}
MoveTowardsLocation(Vector3, Quaternion) retains the independent location’s current Angle; set a finite value after a position-only request set it to 360. Both overloads create/reuse the runtime location and can update an active destination.
StartMoving(MoveTowardsLocation[], Ability) selects an arrival component. StartLocation, OnArriveAbility, and the public configuration properties expose the active workflow.
OnEnableGameplayInput(false/true) brackets owned input, OnCharacterForceIndependentLook brackets final facing, and OnCharacterAbilityActive tracks Speed Change. See State System and NavMeshAgent Movement for cooperating setup.