Nav3DAgent - Nav3D Doc

Docy Child

Nav3DAgent

As mentioned above, you can use the Nav3DAgent script as a component for your game object and access it via GetComponent() or you can create a subclass, which we personally find much more convenient. The following public methods have been implemented to operate with Nav3DAgent.
  • Applies the description for your agent.
				
					public void SetDescription(Nav3DAgentDescription _Description)
				
			
  • The order to move to the point. Any active order will be interrupted, the agent will start moving to the point, in accordance with the parameters of its description.
				
					public void MoveTo(Vector3 _Point, Action _OnReach = null, Action<PathfindingError> _OnPathfindingFail = null)
				
			
  • Add a destination to the queue. In this way, any number of sequence points can be added. If the agent executes the Follow Target order, then this order is interrupted and it starts following the point.
				
					public void MoveToEnqueue(Vector3 _Point, Action _OnReach = null, Action<PathfindingError> _OnPathfindingFail = null)
				
			
  • An order to chase a moving Transform.

				
					public void FollowTarget(
            Transform _Target,
            float _OffsetToleranceUpdate,
            float _DistToReach = 0,
            Action _OnReach = null,
            Action _OnCancel = null,
            Action<PathfindingError> _OnPathfindingFail = null
        )
				
			
  • Transform _Target – Transform to target.
  • float _OffsetToleranceUpdate – the distance by which the shift of the target will cause the path to the target to be updated.
  • If your agent has the Motion Navigation Type of the description set to GLOBAL, or GLOBAL_AND_LOCAL, then each time the pursued Transform is offset by more than _OffsetToleranceUpdate , it will cause the path to be recalculated.
  • float _DistToReach – the distance to the goal, when approaching which the goal will be considered reached. We would like to point out that in the case when an agent has to search for a global path, the goal may never be reached, because after reaching the end of the path, it may turn out that the goal has moved in the past time. Thus, the condition of the coincidence of the coordinates of the pursued target and the agent may be difficult to achieve.
  • Action _OnReach – delegate to be executed when the target is successfully reach
  • Action _OnCancel – a delegate executed if the reference to the pursued Transform becomes null or missing.
  • Stops the execution of the previous commands.
				
					public void Stop()
				
			
  • Allows you to get a list of agents inside the radius _Radius from the agent. Using this method every time you run an update can negatively affect performance, so it is recommended not to call it too often (for example, several times per second should be enough for any game scenarios.).
				
					public List<Nav3DAgent> GetAgentsInRadius(float _Radius, Predicate<Nav3DAgent> _Predicate = null)
				
			
  • Visualizes the agent velocities, radius and paths using Gizmos. May be useful for debugging in the Editor
				
					public void Visualize(bool _DrawRadius = true, bool _DrawPath = true, bool _DrawVelocities = true)
				
			

You can find examples of using Nav 3D Agent in demo scenes located in the Demo folder of the resource.

Agent log

In the second section, you can get the contents of the agent log by clicking on ...

Debug drawing

In the first section, you can visualize the agent and his nearest environment. T...

Creating and configuring an agent description from code

All Nav3DAgentDescription parameters configured in the description inspector c...

Nav3DManager

Nav3DManager is a helper static class. Can be useful for checking whether Nav3D ...

Nav3DInitializer

To use Nav3D in playmode, you need to initialize it. The Nav3DInitializer compon...

Nav3DObstacleLoader

To use the possibility of pre-baking obstacles on the scene in editor mode and t...

Nav3DObstacle

To manage obstacles on the scene, the Nav3DObstacle component is designed. Attac...

Obstacle combinations

We will call obstacles with the selected processing mode “Runtime” as runtim...

Operations with obstacles

Regardless of the obstacle processing mode, the processing procedure consists of...

Deeper dive into obstacles

As already described above, in order for an obstacle to be taken into account du...

Nav3DAgent : Debug

The Nav3DAgent and its inheritors have an inspector that provides several useful...

Nav3DAgent

As mentioned above, you can use the Nav3DAgent script as a component for your ga...

Chat Icon Close Icon
en_USEnglish