public sealed class Sandbox.NavMeshAgent : Sandbox.Component
An agent that can navigate the navmesh defined in the scene.
Related Guides
Broader workflow and conceptual references connected to this API.
Constructors
Showing 1 constructors
public NavMeshAgent()
No results match this filter.
Methods
Showing 7 methods
public void CompleteLinkTraversal()
Finish link traversal, must be called after traversing a link if AutoTraverseLinks is false.
public Vector3 GetLookAhead(float distance)
Get a point on the current path, distance away from here. This is a simplified path so only includes the first few corners.
public Sandbox.Navigation.NavMeshPath GetPath()
Returns the agent's current path as a NavMeshPath. This is not free, so avoid calling it every frame.
Returns
A NavMeshPath containing the agent's current path information.
public void MoveTo(Vector3 targetPosition)
Navigate to the position
public void SetAgentPosition(Vector3 position)
If you want to move the agent from one position to another
public void SetPath(Sandbox.Navigation.NavMeshPath path)
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.
public void Stop()
Stop moving, or whatever we're doing
No results match this filter.
Properties
Showing 20 properties
public float Sandbox.NavMeshAgent.Acceleration { get; set; }
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`.
public Vector3 Sandbox.NavMeshAgent.AgentPosition { get; set; }
Updated with the agent's position, even if UpdatePosition is false
public bool Sandbox.NavMeshAgent.AllowDefaultArea { get; set; }
Is the agent allowed to travel on the default area?
public System.Collections.Generic.HashSet`1<Sandbox.Engine.Resources.NavMeshAreaDefinition> Sandbox.NavMeshAgent.AllowedAreas { get; set; }
What areas the agent is allowed to travel on. If empty, all areas are allowed.
public bool Sandbox.NavMeshAgent.AutoTraverseLinks { get; set; }
Should the agent automatically traverse links when it reaches them? Or do you want to implement your own link traversal logic?
public System.Collections.Generic.HashSet`1<Sandbox.Engine.Resources.NavMeshAreaDefinition> Sandbox.NavMeshAgent.ForbiddenAreas { get; set; }
What areas the agent is not allowed to travel on. If empty, no areas are forbidden.
public float Sandbox.NavMeshAgent.Height { get; set; }
public bool Sandbox.NavMeshAgent.IsNavigating { get; set; }
Returns true if the agent is currently navigating to a target.
public bool Sandbox.NavMeshAgent.IsTraversingLink { get; set; }
Returns true if the agent is currently traversing a link.
public System.Action Sandbox.NavMeshAgent.LinkEnter { get; set; }
Emitted when the agent enters a link.
public System.Action Sandbox.NavMeshAgent.LinkExit { get; set; }
Emitted when the agent exits a link.
public float Sandbox.NavMeshAgent.MaxSpeed { get; set; }
public float Sandbox.NavMeshAgent.Radius { get; set; }
public float Sandbox.NavMeshAgent.Separation { get; set; }
Gets or sets the separation factor used to control how strongly agents avoid crowding each other.
public bool Sandbox.NavMeshAgent.SyncAgentPosition { get; set; }Obsolete
Obsolete: This API member is obsolete.
public System.Nullable`1<Vector3> Sandbox.NavMeshAgent.TargetPosition { get; set; }
Gets the current target position for the agent, if one is set.
public bool Sandbox.NavMeshAgent.UpdatePosition { get; set; }
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.
public bool Sandbox.NavMeshAgent.UpdateRotation { get; set; }
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.
public Vector3 Sandbox.NavMeshAgent.Velocity { get; set; }
public Vector3 Sandbox.NavMeshAgent.WishVelocity { get; set; }
The velocity the agent would like to move at, you can pass this into a PlayerController.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.NavMeshAgent |