Stabilization increases the objective values along the (local) Context.DecidedDirection (back-end class).
This is useful in order to ensure that the agent retains its current direction. This might be helpful in situations where the (local) Context.DecidedDirection varies widely from frame to frame. For that, a value around MaxIncrease is added to those objective values whose receptors' Structure.Direction matches more or less with the (local) Context.DecidedDirection.
The default parametrization of this class increases the objective values along the computed direction by a value of 0.3. All receptors where the Structure.Direction differs more than 45 degrees from the movement direction are ignored.
Back-end class of AIMStabilization. This behaviour is thread-safe.
Public Fields | |
int | TargetObjective = 0 |
Defines the objective for writing values. More... | |
MappingType | AngleMapping = MappingType.InverseLinear |
Sets the mapping type for obtaining objective values. More... | |
float | MaxIncrease = 0.2f |
Determines the maximum possible addition. More... | |
float | MaxAngle = 45f |
Determines the maximum possible deviation in degrees of the (local) Context.DecidedDirection. More... | |
Context | Context |
Reference for quick access to the associated context instance. More... | |
const int | CentralOrder = 1000 |
The minimum Order for behaviours which should be processed before behaviours using LastOrder but after all other behaviours. More... | |
const int | LastOrder = 2000 |
The minimum Order for behaviours which should be processed at last. More... | |
Protected Fields | |
Problem | intermediate = new Problem() |
Holds the intermediate result of this behaviour which can be applied to the context map at the end of an update step using BlendValues(LayerBlendingType, int). More... | |
bool | enabled |
Determines if this IBehaviour is active or inactive. More... | |
Properties | |
SteeringPercept | Self [get, set] |
The data of the associated agent itself. More... | |
bool | Enabled [get, set] |
Determines if this IBehaviour is active or inactive. More... | |
int | Order [get, set] |
Specifies the execution order of this behaviour. More... | |
Public Methods | |
override void | Behave () |
This method executes the main algorithm of this behaviour and is called within Context.Evaluate in order to set/modify objective values for the associated Context.Problem. More... | |
Public Static Methods | |
static float | MapSpecial (MappingType mapping, float min, float max, float value) |
Maps a value lying between min and max to a resulting value between 0 and 1. More... | |
static float | MapSpecialSqr (MappingType mapping, float sqrMin, float sqrMax, float sqrValue) |
Maps a sqrValue lying between sqrMin and sqrMax to a resulting value between 0 and 1, whereby all the given parameters are expected to be squared. More... | |
Protected Methods | |
float | MapBySensitivity (MappingType mapping, Structure structure, Vector3 direction, float sensitivityOffset=0.0f) |
Maps (magnitude) values by sensitivity so that the Structure.Sensitivity (plus the given sensitivityOffset ) is used as similarity threshold for the angle between the given direction and the Structure.Direction. More... | |
float | MapBySensitivityPlane (MappingType mapping, Structure structure, Vector3 planeDirection1, Vector3 planeDirection2, float offset, float sensitivityOffset=0.0f) |
Maps (magnitude) values by sensitivity so that the Structure.Sensitivity (plus the given sensitivityOffset ) is used as similarity threshold for the smallest angle between a plane defined by planeDirection1 , planeDirection2 and the Structure.Direction. More... | |
void | WriteValue (ValueWritingType valueWriting, int objectiveIndex, int valueIndex, float value, bool intermediate=false) |
Writes objective values to the Context.Problem as specified with valueWriting . More... | |
void | BlendValues (LayerBlendingType layerBlending, int objectiveIndex) |
Writes the values of the intermediate to the actual Context.Problem. More... | |