Emerald AI Wiki
  • Home
  • Getting Started
    • Included Demo Scenes
      • Shooter AI Demo
      • Melee Combat Demo
      • Ranged Combat Demo
      • Summoning AI Demo
      • Healing Demo
      • Patrolling Demo
      • Inverse Kinematics Demo
      • Ragdoll Demo
      • Grenade Demo
      • Footsteps Demo
      • Random Waypoints Demo
      • Dynamic Wandering Demo
      • Health Bar Demo
      • Alignment Demo
      • Explosion Damage Demo
      • Sound Detection Demo
      • Fleeing Demo
      • Mouse Movement Demo
      • Companion Demo
      • Equippable Weapon Demo
      • Optimization Demo
      • Working Villager Demo
      • Debugging Demo Scene
    • Getting Started
    • Baking NavMesh
    • Setting up a Player with Emerald AI
    • Upgrading to URP and HDRP
    • Difference Between Emerald AI 3.0 and Emerald AI 2025
  • Help
    • Solutions to Possible Issues
    • Using the Wiki Search Tool
    • Release Notes
    • Support
  • Emerald Components (Required)
    • Animation Component
      • Creating an Animation Profile
      • Opening the Animation Viewer
    • Behaviors Component
      • Creating an Aggressive AI
      • Creating a Companion AI
      • Creating a Cautious AI
      • Creating a Coward AI
      • Creating a Passive AI
      • Creating a Pet AI
      • Creating Custom AI Behaviors
    • Combat Component
      • Assigning Combat Actions
      • Assigning Attack Transforms
      • Assigning Ability Objects
      • Weapon Type Amounts
    • Detection Component
      • Applying a Head Transform
      • Setting up the Detection Layers and Player Tag
      • Faction Relations
    • Movement Component
      • Using the Align AI Settings
      • Using the Dynamic Wander Type
      • Using the Waypoints Wander Type
      • Using the Stationary Wander Type
      • Using the Destination Wander Type
    • Health Component
      • Setting up an AI's Health
      • Setting up an AI's Hit Effects
    • Sounds Component
      • Creating an AI's Sound Profile
  • Emerald Components (Optional)
    • Adding and Removing Optional Components
    • Cover Component
      • Applying the Cover Component
      • Setting up the Cover Component
      • Setting up Cover Nodes
    • Debugger Component
      • Applying the Debugger Component
      • Drawing an AI's Path
      • Drawing an AI's Destination
      • Drawing an AI's Line of Sight
      • Drawing an AI's Undetected Targets Line
      • Debug Log Targets
      • Debug Log Current Obstruction
    • Decal Component
      • Applying the Decals Component
      • Setting up the Decals Component
    • Events Component
      • Applying the Events Component
      • Creating an Event Through the Editor
      • Creating an Event Through Code
    • Footsteps Component
      • Applying the Footsteps Component
      • Setting up the Footsteps Component
    • Inverse Kinematics Component
      • Applying the IK Component
      • Creating an Animation Rig and Multi-Aim Constraint
      • More Info on the Animation Rigging Package
    • Items Component
      • Applying the Items Component
      • Creating Equippable Weapons
    • Location Based Damage Component
      • Applying the LBD Component
      • Assigning Colliders to the LBD Component
      • Damaging the LBD Component
    • Optimization Component
      • Applying the Optimization Component
      • Setting up the Optimization Component
    • Sound Detector Component
      • Applying the Sound Detector Component
      • Understanding the Sound Detector Settings
      • Using an Attract Modifier
    • Target Position Modifier Component
      • Setting up the TPM Component on an AI
      • Setting up the TPM Component on a Player
    • UI Component
      • Applying the UI Component
      • Setting up the UI Component
    • Weapon Collision Component
      • Applying the Weapon Collision Component
      • Setting up the Weapon Collision Component
  • API
    • Accessing the EmeraldAPI Script
    • Available API
      • Movement API
      • Combat API
      • Faction API
      • Sound API
      • Animation API
      • UI API
      • Detection API
      • Behaviors API
      • Health API
      • Items API
    • Damaging an AI
    • Damaging a Custom Character Controller
    • Using the Built-in Object Pooling
  • Emerald Profiles & Objects
    • Ability Object
      • Bullet Projectile Ability
      • Grenade Ability
      • General Projectile Ability
      • Ground Projectile Ability
      • Aerial Projectile Ability
      • Arrow Projectile Ability
      • Melee Ability
      • Teleport Ability
      • Summon Ability
      • Healing Ability
      • Area of Effect Ability
      • The Collider Module
      • The Damage Module
    • Combat Action Object
      • Blocking Combat Action
      • Dodge Combat Action
      • Strafe Combat Action
      • Random Movement Combat Action
      • Switch Target Combat Action
      • Creating Custom Combat Actions Through Code
    • Reaction Object
      • Creating a Reaction Object
      • Included Reaction Objects
    • Animation Profile
      • Creating an Animator Controller
      • Applying Animations
      • Regenerate Animator Controllers
      • Copying Animation Profiles
    • Sound Profile
      • Creating an AI's Sound Profile
      • Setting up Footstep Sounds
      • Setting up Attack Sounds
      • Setting up Warning Sounds
      • Setting up Death Sounds
    • Waypoint Profile
    • Footstep Surface Object
      • Creating a new Footstep Surface Object
      • Setting up a Footstep Surface Object
  • Emerald Managers
    • Setup Manager
      • Setting up an AI with the Setup Manager
    • AI Duplicator Manager
      • Duplicating an AI
    • Animation Viewer Manager
      • Opening the Animation Viewer
      • Previewing Animations
      • Creating and Applying Animation Events
      • Creating Attack Animation Events
    • Faction Manager
      • Modifying Factions Through the Faction Manager
    • Combat Text Manager
      • Adjusting the Combat Text Settings
      • Accessing the Combat Text System Through Code
  • Integrations
    • Integrations
      • Final IK
      • Invector
      • FPS Engine
      • Dialogue System
      • Quest Machine
      • Love/Hate
Powered by GitBook
On this page
  • Change Wander Type
  • Update Dynamic Wander Position
  • Set Dynamic Wander Position
  • Update Starting Position
  • Set Custom Destination
  • Set Destination
  • Generate Random Destination
  • Add Waypoint
  • Remove Waypoint
  • Clear All Waypoints
  • Stop Movement
  • Resume Movement
  • Stop Following
  • Resume Following
  • Start Companion Guard Position
  • Stop Companion Guard Position
  • Rotate Towards Position

Was this helpful?

  1. API
  2. Available API

Movement API

Change Wander Type

Changes the AI's Wander Type. If the Dynamic Wander Type is used, the AI's current position will be updated as the AI's new starting position, which is used by the Dynamic Wander position.

EmeraldAPI.Movement.ChangeWanderType(EmeraldSystem EmeraldComponent, EmeraldMovement.WanderTypes NewWanderType)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.ChangeWanderType(EmeraldComponent,  EmeraldMovement.WanderTypes.Dynamic);

Update Dynamic Wander Position

Updates the AI's dynamic wandering position to the AI's current position.

EmeraldAPI.Movement.UpdateDynamicWanderPosition(EmeraldSystem EmeraldComponent)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.UpdateDynamicWanderPosition(EmeraldComponent);

Set Dynamic Wander Position

Sets the AI's dynamic wandering position to the position of the Destination. This is useful for functionality such as custom AI schedules. Note: This will automatically change your AI's Wander Type to Dynamic.

EmeraldAPI.Movement.SetDynamicWanderPosition(EmeraldSystem EmeraldComponent, Vector3 DestinationPosition)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.SetDynamicWanderPosition(EmeraldComponent, YourVector3Position);

Update Starting Position

Updates the AI's starting position to the AI's current position.

EmeraldAPI.Movement.UpdateStartingPosition(EmeraldSystem EmeraldComponent)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.UpdateStartingPosition(EmeraldComponent);

Set Custom Destination

Overrides the AI's Wander Type to Custom and sets the AI's destination to the Vector3 position. This is useful for functionality like point and click movement, schedules, and more. Because this modifies the AI's Wander Type, the ChangeWanderType function will need to be called again to set the desired Wander Type, if something other than Custom is wanted.

EmeraldAPI.Movement.SetCustomDestination(EmeraldSystem EmeraldComponent, Vector3 DestinationPosition)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.SetCustomDestination(EmeraldComponent, YourVector3Position);

Set Destination

Sets the AI's destination to the Vector3 position. Note: It is recommended that SetCustomDestination is used (when possible) as an AI will still attempt to use their Generated Wander Type position.

EmeraldAPI.Movement.SetDestination(EmeraldSystem EmeraldComponent, Vector3 DestinationPosition)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.SetDestination(EmeraldComponent, YourVector3Position);

Generate Random Destination

Generates a new position to move to within the specified radius based on the AI's current position.

EmeraldAPI.Movement.GenerateRandomDestination(EmeraldSystem EmeraldComponent, int Radius)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.GenerateRandomDestination(EmeraldComponent, 10);

Add Waypoint

Adds a waypoint to an AI's Waypoint List.

EmeraldAPI.Movement.AddWaypoint(EmeraldSystem EmeraldComponent, Transform Waypoint)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.AddWaypoint(EmeraldComponent, YourWaypointTransform);

Remove Waypoint

Removes a waypoint from the AI's Waypoint List according to the specified index.

EmeraldAPI.Movement.RemoveWaypoint(EmeraldSystem EmeraldComponent, int WaypointIndex)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.RemoveWaypoint(EmeraldComponent, YourWaypointIndexNumber);

Clear All Waypoints

Clears all of an AI's current waypoints. Note: When an AI's waypoints are cleared, it will be set to the Stationary wander type to avoid an error. If you want the AI to follow newly created waypoints, you will need to set it's Wander Type back to Waypoint with the ChangeWanderType function (located at EmeraldAPI.Movement.ChangeWanderType).

EmeraldAPI.Movement.ClearAllWaypoints(EmeraldSystem EmeraldComponent)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.ClearAllWaypoints(EmeraldComponent);

Stop Movement

Stops an AI from moving when out of combat. This is useful for functionality like dialogue.

EmeraldAPI.Movement.StopMovement(EmeraldSystem EmeraldComponent)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.StopMovement(EmeraldComponent);

Resume Movement

Resumes an AI's movement after using the StopMovement function.

EmeraldAPI.Movement.ResumeMovement(EmeraldSystem EmeraldComponent)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.ResumeMovement(EmeraldComponent);

Stop Following

Stops an AI with a follow target from following. This will only work if an AI has a Current Follow Target.

EmeraldAPI.Movement.StopFollowing(EmeraldSystem EmeraldComponent)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.StopFollowing(EmeraldComponent);

Resume Following

Allows an AI with a follow target to resume following its follower. This will only work if an AI has a Current Follow Target.

EmeraldAPI.Movement.ResumeFollowing(EmeraldSystem EmeraldComponent)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.ResumeFollowing(EmeraldComponent);

Start Companion Guard Position

Allows a Companion AI (an AI with Follow Target) to guard the assigned position.

EmeraldAPI.Movement.StartCompanionGuardPosition(EmeraldSystem EmeraldComponent, Vector3 PositionToGuard)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.StartCompanionGuardPosition(EmeraldComponent, YourPositionToGuard);

Stop Companion Guard Position

Stops a Companion AI (an AI with Follow Target) from guarding and returns it to their current follower.

EmeraldAPI.Movement.StopCompanionGuardPosition(EmeraldSystem EmeraldComponent)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.StopCompanionGuardPosition(EmeraldComponent);

Rotate Towards Position

Note: The TargetPosition can be an object, a player, another AI, a custom position, etc.

EmeraldAPI.Movement.RotateTowardsPosition(EmeraldSystem EmeraldComponent, Vector3 TargetPosition)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Movement.RotateTowardsPosition(EmeraldComponent, YourTargetPosition);

Last updated 8 months ago

Was this helpful?

Rotates the AI towards the specified target position using the AI's turning animations. The angle in which the AI will stop rotating is based off of an AI's Turning Angle set within the editor. The AI will be unable to move during the duration of the turning process. If an AI is wandering, it is recommended that StopMovement is called first to stop an AI from wandering as an AI can still wander after the rotating has finished.

Movement Component