Scripting API

NavMeshAgent

class in UnityEngine.AI · UnityEngine.AIModule · inherits from Behaviour

49 of 49 of Unity's membersUnity's documentation
In Tassix

Walks its GameObject along the navmesh to a destination. Each AI update (after Update, before LateUpdate) it follows the straightened path's next corner, as Unity's agents do: it moves by the velocity it chose last update, then picks the next one by accelerating toward full speed (or, with auto-braking, slowing just enough to stop at the end once that's within twice its radius), and turns toward it, faster the faster it goes, up to its angular speed. Off-mesh links on the path are taken once the agent comes near their start: on its own it moves onto the link and along it in a time set by its speed, otherwise it waits there until a script calls CompleteOffMeshLink. One agent uses a link at a time. Agents avoid each other and NavMeshObstacles (see NavMeshAvoidance.cs).

Properties 36

float acceleration { get; set; }
int agentTypeID { get; set; }
float angularSpeed { get; set; }
int areaMask { get; set; }
bool autoBraking { get; set; }
bool autoRepath { get; set; }
int avoidancePriority { get; set; }
float baseOffset { get; set; }
OffMeshLinkData currentOffMeshLinkData { get; }
Vector3 desiredVelocity { get; }
Vector3 destination { get; set; }
bool hasPath { get; }
float height { get; set; }
bool isOnNavMesh { get; }
bool isPathStale { get; }
bool isStopped { get; set; }
NavMeshObstacle? navMeshOwner { get; }
OffMeshLinkData nextOffMeshLinkData { get; }
Vector3 nextPosition { get; set; }
ObstacleAvoidanceType obstacleAvoidanceType { get; set; }
NavMeshPath path { get; set; }
Vector3 pathEndPosition { get; }
bool pathPending { get; }
NavMeshPathStatus pathStatus { get; }
float radius { get; set; }
float remainingDistance { get; }
float speed { get; set; }
Vector3 steeringTarget { get; }
float stoppingDistance { get; set; }
bool updatePosition { get; set; }
bool updateRotation { get; set; }
bool updateUpAxis { get; set; }
Vector3 velocity { get; set; }
int walkableMask { get; set; }

Methods 15

bool CalculatePath(Vector3 targetPosition, NavMeshPath path)
bool FindClosestEdge(out NavMeshHit hit)
float GetAreaCost(int areaIndex)
void Move(Vector3 offset)
bool Raycast(Vector3 targetPosition, out NavMeshHit hit)
void ResetPath()
void Resume()
bool SamplePathPosition(int areaMask, float maxDistance, out NavMeshHit hit)
void SetAreaCost(int areaIndex, float areaCost)
bool SetDestination(Vector3 target)
bool SetPath(NavMeshPath path)
void Stop()
bool Warp(Vector3 newPosition)