class NavMeshAgent : Component

book_4_sparkGenerated
code_blocksInput

Description

The NavMeshAgent class in the Sandbox namespace is a component that allows an agent to navigate the navmesh defined in the scene. It provides various properties and methods to control the agent's movement, speed, and pathfinding capabilities.

Members

Instance Methods

Member NameSummary
SetAgentPositionIf you want to move the agent from one position to another
MoveToNavigate to the position
StopStop moving, or whatever we're doing
GetLookAheadGet a point on the current path, distance away from here. This is a simplified path so only includes the first few corners.

Instance Properties

Member NameSummary
HeightPhysical height of the agent.
RadiusPhysical radius of the agent.
MaxSpeedMaximum speed the agent can move.
AccelerationThe 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 MaxSpeed.
UpdatePositionSet 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.
UpdateRotationThis 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.
SeparationControls the separation behavior of the agent to avoid other agents.
AgentPositionUpdated with the agent's position, even if UpdatePosition is false
TargetPositionThe target position the agent is moving towards.
VelocityThe current velocity of the agent.
WishVelocityThe desired velocity of the agent.
SyncAgentPositionObsolete. Synchronizes the agent's position.