The NavMeshAgent is an entity component for automated navmesh navigation and steering. Use NavMeshPathfinder.Create(FrameBase, EntityRef, NavMeshAgentConfig) to create pathfinder components. Also see NavMesh and NavMeshAgentConfig
More...
|
Int32 | CurrentLink (FrameBase f) |
| Returns the link that the agent currently is traversing. More...
|
|
bool | CurrentWaypointHasFlag (FrameBase f, Navigation.WaypointFlag waypointFlag) |
| Test the current waypoint for a flag. More...
|
|
void | ForceRepath (FrameBase f) |
| Forces the agent to repath during the next Update(). Reset the waypoints and waypoint index internally. More...
|
|
FPVector3 | GetWaypoint (FrameBase f, int index) |
| Get the waypoint position by waypoint index. More...
|
|
Navigation.WaypointFlag | GetWaypointFlags (FrameBase f, int index) |
| Access the waypoint flags by index. More...
|
|
Int32 | GetWaypointLink (FrameBase f, int index) |
| Access the waypoint links by index. More...
|
|
bool | IsOnLink (FrameBase f) |
| Agent is active and is currently traversing a link. More...
|
|
void | SetConfig (FrameBase f, EntityRef entity, AssetRef< NavMeshAgentConfig > configAssetRef, bool overwrite=true) |
| Update the agent config during run-time. Will used default agent config from the SimulationConfig if the provided asset ref can not be resolved. Internally calls SetConfig(FrameBase, EntityRef, NavMeshAgentConfig, bool). More...
|
|
void | SetConfig (FrameBase f, EntityRef entity, NavMeshAgentConfig config, bool overwrite=true) |
| Update the agent config during run-time. Uses the default config from the SimulationConfig when config is null . More...
|
|
void | SetTarget (FrameBase f, FPVector3 target, NavMesh navMesh) |
| Set agent target position. Does nothing if the target is in NavMeshAgentConfig.StoppingDistance range. More...
|
|
void | Stop (FrameBase f, EntityRef entity, bool resetVelocity=true) |
| Stops the pathfinder agent immediately and disables it and resets its waypoints. More...
|
|
|
const int | SIZE = 104 |
| The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed. More...
|
|
The NavMeshAgent is an entity component for automated navmesh navigation and steering. Use NavMeshPathfinder.Create(FrameBase, EntityRef, NavMeshAgentConfig) to create pathfinder components. Also see NavMesh and NavMeshAgentConfig
◆ Create()
Use this factory to correctly initialize internals.
- Parameters
-
f | Frame |
entity | Entity |
config | Agent config |
- Returns
- NavMeshPathfinder component that can be Set() on an entity
◆ IsOnLink()
bool Quantum.NavMeshPathfinder.IsOnLink |
( |
FrameBase |
f | ) |
|
|
inline |
Agent is active and is currently traversing a link.
- Parameters
-
- Returns
true
is waypoint is active, agent has waypoints and the current waypoint is a link end
Its current waypoint has the Navigation.WaypointFlag.LinkEnd flag.
◆ CurrentLink()
Int32 Quantum.NavMeshPathfinder.CurrentLink |
( |
FrameBase |
f | ) |
|
|
inline |
Returns the link that the agent currently is traversing.
- Parameters
-
- Returns
- Link index pointing into Navmesh.Links[] or -1
◆ CurrentWaypointHasFlag()
Test the current waypoint for a flag.
- Parameters
-
f | Frame |
waypointFlag | Flag to test for |
- Returns
true
if the agent is active, has waypoints and if the current waypoint has the provided flag.
◆ GetWaypoint()
Get the waypoint position by waypoint index.
- Parameters
-
f | Frame |
index | Waypoint index |
- Returns
- 3D waypoint position, zero if waypoint index is not valid
◆ GetWaypointFlags()
Access the waypoint flags by index.
- Parameters
-
f | Frame |
index | Waypoint index (0..MaxWaypoints) |
- Returns
- Mask of Navigation.WaypointFlag
◆ GetWaypointLink()
Int32 Quantum.NavMeshPathfinder.GetWaypointLink |
( |
FrameBase |
f, |
|
|
int |
index |
|
) |
| |
|
inline |
Access the waypoint links by index.
- Parameters
-
f | Frame |
index | Waypoint index (0..MaxWaypoints) |
- Returns
- Link index pointing into in Navmesh.Links[] or -1
◆ SetConfig() [1/2]
Update the agent config during run-time. Uses the default config from the SimulationConfig when config is null
.
- Parameters
-
f | Frame |
entity | Agent entity, required to forward the config to other agent components |
config | Agent config asset |
overwrite | Reset properties to their respective config values (e.g. NavMeshSteeringAgent.MaxSpeed, NavMeshAvoidanceAgent.Priority, ..) |
Will set the config for NavMeshSteeringAgent and NavMeshAvoidanceAgent components on this entity as well.
This can trigger a repath when the waypoint count is changed.
◆ SetConfig() [2/2]
Update the agent config during run-time. Will used default agent config from the SimulationConfig if the provided asset ref can not be resolved. Internally calls SetConfig(FrameBase, EntityRef, NavMeshAgentConfig, bool).
- Parameters
-
f | Frame |
entity | Agent entity, required to forward the config to other agent components |
configAssetRef | Asset ref to navmesh config. |
overwrite | Reset properties to their respective config values (e.g. NavMeshSteeringAgent.MaxSpeed, NavMeshAvoidanceAgent.Priority, ..) |
◆ SetTarget()
Set agent target position. Does nothing if the target is in NavMeshAgentConfig.StoppingDistance range.
- Parameters
-
f | Frame object |
target | Target position will be saved as Target and clamped to the grid as InternalTarget |
navMesh | The navmesh the agent uses during navigation |
Will reset the current waypoint list.
When the agent is currently on a link, the target position is saved but the waypoints are left intact. The current waypoint is then marked with Navigation.WaypointFlag.RepathWhenReached.
◆ ForceRepath()
void Quantum.NavMeshPathfinder.ForceRepath |
( |
FrameBase |
f | ) |
|
|
inline |
Forces the agent to repath during the next Update(). Reset the waypoints and waypoint index internally.
◆ Stop()
void Quantum.NavMeshPathfinder.Stop |
( |
FrameBase |
f, |
|
|
EntityRef |
entity, |
|
|
bool |
resetVelocity = true |
|
) |
| |
|
inline |
Stops the pathfinder agent immediately and disables it and resets its waypoints.
- Parameters
-
f | Frame |
entity | Requires the entity to check for the SteeringAgent |
resetVelocity | If true it will check for a SteeringAgent component and set the velocity to zero |
◆ Serialize()
static void Quantum.NavMeshPathfinder.Serialize |
( |
void * |
p, |
|
|
FrameSerializer |
serializer |
|
) |
| |
|
inlinestatic |
Callback to serialize this component into a snapshot of the game state.
- Parameters
-
p | The component pointer |
serializer | The serializer |
◆ SIZE
const int Quantum.NavMeshPathfinder.SIZE = 104 |
|
static |
The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed.
◆ RegionMask
Set individual region mask for this agent.
◆ ConfigId
AssetGuid Quantum.NavMeshPathfinder.ConfigId => _configId |
◆ InternalTarget
FPVector3 Quantum.NavMeshPathfinder.InternalTarget => _internalTarget |
Target position is potentially corrected and moved inside the navmesh (read only).
◆ NavMeshGuid
AssetGuid Quantum.NavMeshPathfinder.NavMeshGuid => _navMeshID |
Current assigned navmesh.
◆ Target
FPVector3 Quantum.NavMeshPathfinder.Target => _inputTarget |
Input target position set by SetTarget(). (Read Only)
◆ WaypointIndex
int Quantum.NavMeshPathfinder.WaypointIndex => _waypointIndex |
The current waypoint the agent steers towards or -1 if there are no stored waypoints.
◆ WaypointCount
int Quantum.NavMeshPathfinder.WaypointCount => _waypointCount |
The number of waypoints currently stored on the agent.
The number of waypoints stored can be lower than the actual computed path (for performance reasons during copying the frame memory).
The first waypoint is always the agent position when the path finding triggered.
The last waypoint is a regular waypoint but a re-pathing is executed when the agent is steering toward it to reduce glitches during path recalculations.
◆ WaypointMaxCount
int Quantum.NavMeshPathfinder.WaypointMaxCount => _waypointCapacity |
◆ IsActive
bool? Quantum.NavMeshPathfinder.IsActive |
|
getset |
The active state of the agent.
Agent can be active and have no waypoints. That usually means, that the agent will try to find a path during the next tick.
◆ WaypointDetectionDistanceSqr
FP Quantum.NavMeshPathfinder.WaypointDetectionDistanceSqr |
|
getset |