Behavior Designer
The integration for Behavior Designer is located in SensorToolkit/Integrations/Behavior Designer
. In there you'll find a file behavior-designer-integration.asset
. Double-click it to extract the files. Make sure you already have Behaviour Designer imported into your project or you will get compile errors.
A unity scene called demo will be extracted. Open it up to see a simple example of how to build behaviour trees that use the integration.
A portion of the behavior tree that will seek towards a detected object
The integration includes some custom Action
s and Conditional
s. These will be found in the Behavior Designer Tasks viewer under the SensorToolkit category.
Actions
Get Detections
Queries the sensor for the GameObjects it detects. Returns success if at least one object is detected. Returns false otherwise. It's possible to restrict the query to objects with a specific tag.
Get Signal
Retrieve the Signal
data for a GameObject. This will give you the objects visibility (Signal Strength) and its bounding box. Returns failure if the object isnt detected.
Pulse
Manually pulses the sensor.
Get Detection Ray Hit
For a valid raycasting sensor this will retrieve the ray intersection details for a detected object. Works with the Ray Sensor, Arc Sensor and their 2D analogues. Returns failure if the object is not detected.
Set Seek Target
Sets the destination that a steering sensor should seek towards. The destination can be either a GameObject
or a world-space Vector3
. The Target Distance can be increased to create a 'flee' behaviour.
Set Strafe Target
If the Steering Sensor has built-in locomotion enabled this will control the strafing behaviour. The target is a direction or GameObject
the agent should face while it seeks it's destination. Call this with no parameters to stop strafing.
Conditionals
Is Detected
Returns success if the target object is detected by the sensor. Returns failure otherwise.
Has Any Detection
Returns success if the sensor has at least one detection. Returns failure otherwise.
Is Obstructed
For a valid raycasting sensor this will retrieve the ray intersection details where it's obstructed. Works with the Ray Sensor, Arc Sensor, NavMesh Sensor and their 2D analogues. Returns failure if there is no obstruction.
Is Seeking
Returns success when the SteeringSensor is currently seeking towards a destination. Returns false if it's not seeking or has already reached its destination.