Polarith AI
1.7
SteeringBehaviour Class Reference

Description

SteeringBehaviour provides the base functionality for writing and mapping objective values (back-end class).

This derived PerceptBehaviour<T> is the very foundation for all context steering algorithms. The objective values are written into an associated Context.Problem which is evaluated in Context.Evaluate based on the inherited PerceptBehaviour<T>.Percepts and PerceptBehaviour<T>.Self. In order to obtain and write objective values, the three methods StartSteering, PerceptSteering and ReceptorSteering are used for setting up an appropriate ResultDirection and ResultMagnitude, whereby the switches ValueMapping and ValueWriting determine how objective values are written. In addition, with the help of VectorProjection it is possible to project the perceived vector data which are necessary for obtaining objective values into a specified plane. This might be useful, for example, when there is a (virtual) ground and height map in the world, so this is always the case when the scene objects differ significantly in height.

Every derived SteeringBehaviour needs to implement the properties forEachPercept and forEachReceptor to determine if the corresponding methods PerceptSteering and ReceptorSteering are called within Behave. Usually, you might only want either PerceptSteering or ReceptorSteering to be called at once.

A SteeringBehaviour can be marked as thread-safe in its corresponding front-end class through setting AIMBehaviour.ThreadSafe to true. If you do this, be sure not to use reference types of the Unity scripting API and not to make any possibly unsafe variable writes. If at least one behaviour is not marked AIMBehaviour.ThreadSafe, the whole agent will not be part of the multithreading (Pro only).

Base back-end class of every derived AIMSteeringBehaviour.

Inheritance diagram for SteeringBehaviour:
PerceptBehaviour< SteeringPercept > Align Follow Orbit RadiusSteeringBehaviour Wander Adjust Arrive Avoid PlanarAvoid PlanarAvoidBounds PlanarSeekBounds Pursue Seek SeekBounds SeekNavMesh

Public Fields

Vector3 ResultDirection
 The direction vector used for obtaining objective values. More...
 
float ResultMagnitude
 The magnitude value used for obtaining objective values. More...
 
int TargetObjective
 Defines the objective for writing values. More...
 
float MagnitudeMultiplier = 1f
 Is multiplied to the ResultMagnitude in order to weight between different behaviours. More...
 
float SensitivityOffset
 Is added to the Structure.Sensitivity as threshold for writing objective values. More...
 
ValueWritingType ValueWriting = ValueWritingType.AssignGreater
 Sets the type for writing objective values. More...
 
LayerBlendingType LayerBlending = LayerBlendingType.None
 Sets the operation for blending the behaviour results into the context. More...
 
LayerNormalizationType LayerNormalization = LayerNormalizationType.None
 Sets the method for normalizing intermediate objective values while they are blended into the context. More...
 
MappingType ValueMapping = MappingType.InverseLinear
 Sets the mapping type for obtaining objective values. More...
 
bool UseSignificance = true
 Determines if the SteeringPercept.Significance (if there is a AIMSteeringTag) is multiplied to the ResultMagnitude in order to weight between different percepts. More...
 
bool UseSensorProjection = true
 If true, Sensor.ProjectionMode is used as VectorProjection. More...
 
VectorProjectionType VectorProjection = VectorProjectionType.None
 Sets the type for projecting the perceived vector data into a plane. More...
 
PresetVelocityType PresetVelocity = PresetVelocityType.None
 If the value is anything other than PresetVelocityType.None, a game object's rotation and default forward direction is used to approximate its actual velocity. More...
 
PredictionType Prediction = PredictionType.None
 If set to anything other than PredictionType.None, the position of the Self percept is updated according to the given velocity. More...
 
float PredictionMagnitude = 0.0f
 Scales the velocity vector used for predicting the possible future position of an agent if Prediction is set to PredictionType.PredictionMagnitude. More...
 
readonly IList< T > Percepts
 All percepts which are relevant for an agent. More...
 

Protected Fields

readonly SteeringPercept self = new SteeringPercept()
 The data of the associated agent itself (read only). More...
 
readonly SteeringPercept percept = new SteeringPercept()
 The data of the currently processed percept (read only). More...
 
IList< float > objective
 Quick access to the currently processed objective. More...
 
ISensor< Structuresensor
 Quick access to the currently processed sensor. More...
 
IReceptor< Structurereceptor
 Quick access to the currently processed receptor. More...
 
Structure structure
 Quick access to the currently processed structure. More...
 
Vector3 velocity = Vector3.forward
 The forward direction the agent moves towards and/or looks at by default. More...
 

Properties

abstract bool forEachPercept [get]
 Determines if PerceptSteering is called within Behave (read only). More...
 
abstract bool forEachReceptor [get]
 Determines if ReceptorSteering is called within Behave (read only). More...
 
override SteeringPercept Self [get, set]
 The data of the associated agent itself. More...
 

Public Methods

override void Behave ()
 This method executes the main context steering algorithm and is called within Context.Evaluate in order to set/modify objective values for the associated Context.Problem. More...
 

Protected Methods

virtual bool StartSteering ()
 Gets called at the beginning of the context steering algorithm for each processed percept and should be used to pre-compute things like distances or to check whether a percept is relevant at all. More...
 
virtual void PerceptSteering ()
 This method gets called once for each processed percept. More...
 
virtual void ReceptorSteering ()
 This method gets called for each active shape receptor for each processed percept. More...
 
Imprint