User Tools

Site Tools


Character Controller Motor


  • Use Unity Messages (Advanced): Whether the AI is initialized and updated by Unity or done manually.
  • Use Fixed Update (Advanced): Whether the AI responds to Unity Update or FixedUpdate messages. Only valid if Use Unity Messages is checked.
  • Is Active (Advanced): Whether the AI is currently updating.
  • Body: The GameObject that the AI will move and animate.
  • Speed: The default speed (in meters per second) to use when this AI moves.
  • Rotation Speed: The default rotation speed (in degrees per second) to use when the AI turns.
  • Close Enough Distance: When the AI is within this distance to a target we consider it finished moving.
  • Close Enough Angle: When the AI is within this degree to a target we consider it finished turning.
  • Face Before Move Angle: When moving to a target this is how close we have to be to facing the target before we will move.
  • Step Up Height: Mainly used by the Basic Navigator to determine whether or not the AI is on a navigation graph. If the AI is below a graph by more than the Step Up Height it does not use that graph for the current path.
  • Allow 3DMovement: Whether or not to allow movement in 3D. If checked, the AI will no longer use the Basic Navigator to path.
  • Allow 3DRotation: Whether or not to allow rotation in 3D. If used in tandem with Allow 3DMovement it will allow an AI to point in the direction it is heading even if it is above it.
  • Valid Path Required: Whether or not the AI requires a valid path from the Basic Navigator.


As the name implies, the Character Controller Motor uses a CharacterController to move the AI in the world. It can also calculate paths using the current Navigator (likely a Basic Navigator).

It can handle most of the things a human AI would need when moving, like gravity, steps, and ramps, but it comes at a cost. The CharacterController tends to be more expensive then a Rigidbody or direct movement.


Within custom actions it is possible to move the AI using the Motor property (which can be a Basic Motor, Character Controller Motor, Mecanim Motor, or Custom Motor). The Move node does this and has even more features, so there is no need to actually do this in a custom action, unless you need to work outside of the Move node.

using RAIN.Action;
using RAIN.Core;
using UnityEngine;
public class MoveSomewhere : RAINAction
    public MoveSomewhere()
        actionName = "MoveSomewhere";
    public override ActionResult Execute(AI ai)
        ai.Motor.MoveTarget.VectorTarget = ai.WorkingMemory.GetItem<Vector3>("MyMoveTarget");
        ai.Motor.FaceTarget.VectorTarget = ai.WorkingMemory.GetItem<Vector3>("MyFaceTarget");
        return ActionResult.RUNNING;

You can also do something similar outside of the behavior tree altogether. Again, the Move node is much faster to setup, and already does what this example shows. The only reason to do this would be if you need to work around the Basic Mind, and we have a better way to do that through a Custom Mind.

using RAIN.Core;
using UnityEngine;
public class ManualMove : MonoBehaviour
    private Vector3 _destination;
    private AIRig _aiRig = null;
    void Start()
        _aiRig = GetComponentInChildren<AIRig>();
    void Update()
        // This updates the AI so that it knows where the body is
        _aiRig.AI.Motor.MoveTarget.VectorTarget = _destination;
        // This applies the movement that the motor just did

See Also

rainelements/charactercontrollermotor.txt · Last modified: 2022/08/13 18:13 (external edit)