Navigation mesh (AtomsUnreal)

 

Navigation Module

The navigation module uses the Unreal navmesh to move agents to a target location. This module controls only the agent direction.

Target mode

The “Target Mode“ property controls the type of target used by the component:

  • Target position: this mode uses the location provided by the “Target Position“ property as the target location. An agent reaches his target when its distance from the target is less than the “target radius“ property. Instead, to set a specific value onto the “target position“ property, an agent metadata can be used. Use the “Target metadata name“ property to set the name of a vector3 metadata that contains the target location.

  • Random point: this mode chooses a random point on the navmesh as the target location. The random point is chosen in a specific radius around the agent location. The property “Find Target Point Radius“ is used as the radius. Each agent has a different target point. When an agent reaches his target point, the module stops the execution for the current agent. If you want the agent to choose another random point, turn on the property “Find New target Point on Reach“. An agent reaches his target when its distance from the target is less than the “target radius“ property.

  • Position sequence: this mode uses a list of target locations. The property “Target Position Sequence“ contains this list. Each agent starts to reach the first location inside this list. When an agent reaches this location then moves to the next location. The property “Loop target sequence“ is used to loop the sequence, so each agent starts from the beginning after it reaches the last target. An agent reaches his target when its distance from the target is less than the “target radius“ property.

  • Target actor: this mode uses the actor from the property “Target Actor“ as the target location. If the target actor has no target formation component then its location is used, otherwise, the formation location returned by the formation component is used. An agent reaches his target when its distance from the target is less than the “target radius“ property.

  • Target actor sequence: this mode uses a list of actors. The property “Target actor sequence“ contains this list. Each agent starts to reach the first actor inside this list. When an agent reaches it then it moves to the next actor. The current target actor location is used as the target location if it has no target formation component, otherwise, the target location returned by the formation actor is used. An agent reaches his target when its distance from the target is less than the “target radius“ property. The property “Loop target sequence“ is used to loop the sequence, so each agent starts from the beginning after it reaches the last target. You can control the sequence order using the “sequence Index“ property. When this property has a value of -1 then the sequence is executed in order. If it has a value different than -1, then the agents are forced to reach the target with that index value. So if you provide a value of 2, the agents will reach directly the third target actor. The property “Ignore sequence target after reached“ is also used with the target actor sequence mode. Turn on this property if you want to let the agent ignore his target after it reaches it and it goes outside the “target radius“ distance.

Navigation path

This module asks the Unreal navmesh system for a navigation path for each agent. Several properties can be used to control the nav path query:

  • Projection query extent: before the module asks for the nav path it projects the agent location and the target location onto the navmesh. The projection requires an extent box used as the max search distance to find the projection. If this distance is not enough the nav mesh query fails. The module uses the agent bounding box as the extent. This property is a multiplier. So if you provide a value of 3 then the agent bouning box multiplied by 3 is used as extent.

  • Compute path at every tick: If this property is active then at every tick the agent asks for a new nav path and corridor. Otherwise, the agent asks first for a valid corridor (a list of nav mesh face ids that connect the agent location to the target location), then at each tick the module check first if the target location is moved or if the agent is outside the current corridor. If the agent is outside then it computes automatically a new corridor. After that, it computes a small path to the first 2 next corners.

  • Optimize path visibility: When the property is on, each agent tries to optimize its path, generating a straight line between its current position and the first visible corner.

  • Max number of agents per tick: This property controls the max number of agents that can ask for a new corridor at each tick. Since finding a new corridor is expensive, this property can be used to split the works on multiple ticks and let only a max number of agents ask for a new corridor for each tick.

  • Allow partial path query: Allow the return of a partial path/corridor instead of the full path. When an agent reaches its last partial corridor polygon it automatically asks for a new corridor to reach the real target.

  • Path wall offset: This is an offset applied to the corners when the agent generates the path to the first two corners at each tick. Please take in mind that this is limited by the polygon edge distance of the corridor polygon on the corner. If on the corner there is an edge of length 500 and you provide an offset of 800, the real offset used is 500.

Each agent can store a corridor up to 256 face id. If you want increase this limit change the “Max corridor length“ setting inside the AtomsCrowd plugin settings in your project.

Agent direction

The module changes the agent direction at each tick so that the agent follows the navigation path. These properties control how the module influences the agent direction:

  • Weight: global module weight.

  • Max turn angle: max turn angle the agent can use to match its direction with the direction from the nav path. It is in degrees per second: So a value of 100 means that the agent has a maximum angular velocity of 100 degrees/s.

  • Align at init frame: when this property is active the max turn angle is ignored at the first frame so the agent matches immediately its direction with the nav path direction.

Target trigger metadata

The navigation module can change a metadata when an agent reaches its target location. This can be used as a trigger for other logic. When an agent reaches its target, it set the value provided by the “trigger metadata value“ into the metadata that has the same name provided by the property “trigger metadata name“. For example, if you set “targetLinearVelocity“ as the trigger metadata name and a trigger metadata value of 0, the module sets the targetLinearVelocity at 0 as soon the agent reaches its target. You can interpolate the trigger metadata using the “trigger metadata falloff time“. This is the time in seconds used to interpolate the trigger metadata from its start value to the “trigger metadata value” property.

 

Behaviour Tree

If you don’t want to use the navigation component you can use the GoTo behaviour tree task node. It uses the same navigation path logic of the navigation component, but all the target mode properties are missing since the same logic can be expressed with other behaviour tree nodes. For example, if you need the same trigger metadata you can use the setBlackboarEntry/setAgetnMetadata nodes executed after the goto node, while the target sequence can be replaced with a blackboard entry and an iterator decorator.

 

 

Copyright © 2017, Toolchefs LTD.