Behavior Designer – Movement Pack
The Behavior Designer – Movement Pack includes 17 tasks focused on movement. The default set of Movement Pack tasks use Unity’s navigation mesh to traverse the world. The Movement Pack doesn’t do the actual movement – it instead sets the destination for the underlying pathfinding implementation (Unity’s NavMesh, A* Pathfinding Project, etc).
Included Tasks
Can Hear Object
Determines if there are any objects within hearing range of the current agent.
Can See Object
Determines if there are any objects are within sight of the agent.
Cover
Finds a place to hide and move to it. The task can optionally look at the cover point after the agent has arrived.
Evade
Evades the target specified. Evade will predict where the target is headed based on the Look Ahead Distance. Evade is similar to Flee except Evade uses the target’s velocity to predict where to move towards whereas Flee only uses the target’s position.
Flee
Flees from the target specified. Flee will predict where the target is headed based on the Look Ahead Distance.
Flock
Moves a group of agents in a flocking behavior. The behavior can be adjusted with the alignment, cohesion, and separation weights.
Follow
Follows the specified target.
Leader Follow
Controls a group of agents which follow a specified leader. The follow behavior can be adjusted with the separation and neighbor distance values.
Move Towards
Move towards the specified position. The position can either be specified by a Transform or position. If the Transform is used then the position will not be used. The Move Towards task does not use any underlying pathfinding implementation and moves the agent with Vector3.MoveTowards.
Patrol
Patrols around the specified waypoints. The agent can optionally pause at each waypoint.
Pursue
Pursues the target specified. Pursue will predict where the target is headed based on the Target Distance Prediction value.
Queue
Controls a group of agents to move in a line. The queue formation can be controlled with the neighbor and separation distance values.
Rotate Towards
Rotates towards the specified rotation. The rotation can either be specified by a Transform or rotation. If the Transform is used then the rotation will not be used. The Rotate Towards task does not use any underlying pathfinding implementation and moves the agent with Quaternion.RotateTowards.
Search
Searches for a target by combining the Wander, Can See Object, and Can Hear Object tasks.
Seek
Seeks the target specified. Seek is similar to Move Towards except uses pathfinding to move.
Wander
Wanders around the available pathfinding area. Wander will determine the next location to move to based on a random angle from the current look rotation.
Within Distance
Determines if there are any objects within the distance specified of the current agent.
Integrations
You can download the Movement Pack integrations from this page. After you have imported an integration you can start to use the integration tasks by adding them to your behavior tree. For example, if you want to use the A* Pathfinding Project version of the seek task you would add the task located under Actions -> Movement -> A* Pathfinding Project -> Seek.
Common Questions
Why does the agent wobble at the destination point instead of stopping?
If the agent doesn’t stop moving at the destination point the Stopping Distance parameter on the NavMeshAgent is too small. Try increasing this value. We have had good results with a value of 0.1.
Why doesn’t Can See Object detect the target object?
When Can See Object tries to detect the target object it fires a raycast from the agent’s pivot position to the target’s pivot position. If the pivot position is located beneath the ground collider then Can See Object will not be able to see the object and return a status of failure. This can be solved by increasing the y value of the Offset and Target Offset field of the Can See Object Task.
On the Can See Object task you can enable Draw Debug Ray. This will draw a line within the scene view to help visualize what is wrong. The line will be drawn from the agent’s position to the target object’s position (taking into account the offsets). The line will be colored based on the status of the line of sight check:
- Magenta: The target is too far away from the agent.
- Red: The target is not within the field of view of the agent.
- Yellow: Another object is blocking the target.
- Green: The target can be seen.
Does the Movement Pack work in 3D space for a space or underwater game?
Pathfinding in 3D space is computationally expensive so there are no pathfinding implementations built into Unity or the Asset Store which can do it. While no true 3D pathfinding implementation exists there are a few workarounds:
- Fake it by placing an invisible plane that the pathfinding implementation uses. The relative y position can then be adjusted with a separate height adjusting component and the agent will appear to be moving in 3D space.
- In certain pathfinding implementations (such as Unity’s NavMesh) the height offset can be adjusted. This is similar to the above workaround except it doesn’t require the position to be manually updated.
- Do not use any pathfinding implementation at all and instead use basic steering behaviors with local avoidance. This would have to be done using custom tasks as the Movement Pack doesn’t support steering behaviors as an implementation.