Skip to content

NavMeshAgent

extends Component

The NavMeshAgent component is typically used on character objects and allows them to navigate towards a target while avoiding each other.

typescript
let obj = new GameObject();
let com = obj.AddComponent<NavMeshAgent>(NavMeshAgent);

成员变量

NavMeshAgent.agentTypeID : string
Selects the agent role.
NavMeshAgent.speed : number
The maximum movement speed when following a path.
NavMeshAgent.angularSpeed : number
Angular velocity of the agent during rotation, in degrees per second.
NavMeshAgent.acceleration : number
Acceleration during movement.
NavMeshAgent.stoppingDistance : number
Set the stopping distance for the agent.
NavMeshAgent.autoBraking : boolean
Whether the agent automatically stops when reaching the destination.
NavMeshAgent.baseOffset : number
The offset of the agent relative to the bound GameObject in the y-axis direction.
NavMeshAgent.radius : number
The radius for the agent to avoid obstacles.
NavMeshAgent.height : number
The distance at which the agent avoids obstacles in the vertical direction.
NavMeshAgent.avoidancePriority : number
The priority of the agent's obstacle avoidance.
NavMeshAgent.autoTraverseOffMeshLink : boolean
Whether the agent is active.
NavMeshAgent.velocity : Vector3
The current velocity of the agent.
NavMeshAgent.destination : Transform
The specified destination position.
NavMeshAgent.desiredVelocity : Vector3
(Read Only) The desired velocity of the agent.
NavMeshAgent.areaMask : number
Specifies on which navigation meshes the agent is allowed to move.
NavMeshAgent.updatePosition : boolean
Whether to forcefully synchronize the transform of the agent with the pathfinding result.
NavMeshAgent.path : NavMeshPath
Get a path from the agent's current position to the agent's destination.