Inheritence

Summary

An agent that can navigate the navmesh defined in the scene.

Constructors

NavMeshAgent

Fields

CurrentLinkTraversal Information about the current link traversal.

Properties

Acceleration The maximum acceleration a agent can have. This is how fast the agent can change its velocity. If you want snappy movement this should be as high or higher than Sandbox.NavMeshAgent.MaxSpeed.
AgentPosition Updated with the agent's position, even if UpdatePosition is false
AllowDefaultArea Is the agent allowed to travel on the default area?
AllowedAreas What areas the agent is allowed to travel on. If empty, all areas are allowed.
AutoTraverseLinks Should the agent automatically traverse links when it reaches them? Or do you want to implement your own link traversal logic?
ForbiddenAreas What areas the agent is not allowed to travel on. If empty, no areas are forbidden.
Height
IsNavigating Returns true if the agent is currently navigating to a target.
IsTraversingLink Returns true if the agent is currently traversing a link.
LinkEnter Emitted when the agent enters a link.
LinkExit Emitted when the agent exits a link.
MaxSpeed
Radius
Separation Gets or sets the separation factor used to control how strongly agents avoid crowding each other.
SyncAgentPositionobsolete
TargetPosition Gets the current target position for the agent, if one is set.
UpdatePosition Set the Position of the GameObject to the agent position every frame. You can turn this off and handle it yourself by using the AgentPosition property.
UpdateRotation This will simply face the direction it is moving. It is not configurable on purpose, so you should really turn this off and be doing this yourself if you need it to do anything specific.
Velocity
WishVelocity The velocity the agent would like to move at, you can pass this into a PlayerController.

Methods

CompleteLinkTraversal Finish link traversal, must be called after traversing a link if AutoTraverseLinks is false.
GetLookAhead Get a point on the current path, distance away from here. This is a simplified path so only includes the first few corners.
GetPath Returns the agent's current path as a NavMeshPath. This is not free, so avoid calling it every frame.
MoveTo Navigate to the position
SetAgentPosition If you want to move the agent from one position to another
SetPath Assigns a precalculated path for the agent to follow. The agent will attempt to follow the path, but may adjust its movement to avoid obstacles or other agents. If the path becomes invalid during navigation, it may be recalculated completely.
Stop Stop moving, or whatever we're doing
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.