Rotate Towards
Rotate Towards keeps the character facing an assigned Transform while allowing ordinary movement. Use it for conversations, interactions, or an AI focus point. The target is resolved by the owning gameplay system and supplied directly.
Configure target facing
- In Ultimate Character Locomotion > Abilities, select + and add Rotate Towards.
- Assign Target to a Transform with nonzero planar separation from the character. Its vertical offset is ignored; the character turns around its current up axis.
- Choose automatic tracking or the temporary manual workflow below.
- Place this non-concurrent ability above actions it should replace and below critical reactions such as death or ragdoll.
| Setting | Default | Purpose |
|---|---|---|
| Target | None | Direct Transform to track; assign it before starting. |
| Start Type / Stop Type | Automatic / Manual | Assigned target permits continuous automatic tracking. |
| Allow Positional Input / Allow Rotational Input | Enabled / Enabled | Translation remains available; the ability supplies target-facing rotation while active. |
| State | Empty | Optionally applies properties for the facing mode. |
| Ability Index Parameter | -1 |
Uses the existing Animator setup without a dedicated branch or completion event. |

Tune Ultimate Character Locomotion > Motor Rotation Speed for the turn response. The source default is 0.15; this is a spherical-interpolation response factor rather than degrees per second. Rotation follows this setting for both in-place and root-motion characters. For animation-owned turn timing, use the clip’s root rotation as the facing owner instead.
Own the target lifecycle
| Pattern | Setup and cleanup |
|---|---|
| Always face one scene object | Assign Target and retain automatic start. Tracking stays active after alignment. |
| Temporary interaction | Use Start Type > Manual, assign Target, and call TryStartAbility. Clear Target when the interaction ends. |
| Moving focus | Assign a replacement Transform through Target while active; tracking updates without a restart. |
| Death, interruption, or target removal | Clear Target or disable the ability as part of the owner/State cleanup. Clear it before destroying the object. |
An assigned target remains eligible for automatic tracking after another system stops the ability. Disabling the target GameObject also leaves its Transform reference assigned; explicitly clear or replace it when tracking should end.
Use Assist Aim, an interaction detector, or another game system to select a target, then assign it. Target Orbit reshapes movement around a target, and item Aim owns item/look-source aiming. Rotate Towards supplies facing; approach, distance, orbit motion, and camera framing belong to their respective workflows.
Rotation and clearance
Locomotion first calculates input/root-motion rotation. Rotate Towards then flattens the direction to the target in the character’s local up frame, interpolates toward it using Motor Rotation Speed × Delta Time, and writes Desired Rotation during UpdateRotation.
Later writers in that phase can replace it, followed by ApplyRotation modifiers such as Restrict Rotation. Another ordinary non-concurrent ability generally replaces Rotate Towards rather than running beside it; concurrent regular and item abilities can still affect the final rotation.
Keep the target planarly separated, including when it passes above/below the character. Provide enough body clearance through the turn and test the full collider near obstacles. Use a project-specific collision-aware rotation owner for constrained turning spaces.
Verify tracking and release
- Assign a target several metres ahead and to one side. In Play Mode, confirm (Active) and continued tracking after the character reaches the heading.
- Move the target around the character, then change only its height. Confirm continuous level facing around the character’s up axis.
- Move the character and compare low/high Motor Rotation Speed, including root-motion setups. Confirm translation and the selected facing owner behave together.
- Test higher-/lower-priority actions and any concurrent/item rotation writers. Confirm interruption cleanup clears the target or disables this mode as designed.
- Clear the public
Targetproperty. Confirm the ability stops and automatic mode stays inactive until another target is assigned. Repeat target replacement/removal with a clear planar separation.
For missing activation, check Enabled, target assignment, and regular ability priority. For an unexpected restart, inspect target ownership and automatic mode. For unstable facing, inspect separation and later rotation writers. For camera or upper-body pitch, configure the corresponding look/aim system.
Control an interaction
Use UltimateCharacterLocomotion.TryStartAbility/TryStopAbility for manual control. Assigning null through the public Transform Target property stops an active instance. Standard OnCharacterAbilityActive notifications report activation; the owning interaction decides when alignment is sufficient.
This example requires Start Type > Manual:
using Opsive.UltimateCharacterController.Character;
using Opsive.UltimateCharacterController.Character.Abilities;
using UnityEngine;
public class FaceInteractionTarget : MonoBehaviour
{
[SerializeField] private UltimateCharacterLocomotion m_CharacterLocomotion;
private RotateTowards m_RotateTowards;
private void Awake()
{
m_RotateTowards = m_CharacterLocomotion.GetAbility<RotateTowards>();
}
public void BeginFacing(Transform target)
{
m_RotateTowards.Target = target;
m_CharacterLocomotion.TryStartAbility(m_RotateTowards);
}
public void StopFacing()
{
m_RotateTowards.Target = null;
}
}
See Abilities, State System, and New Ability for custom ownership and rotation workflows.