Polarith AI
1.8
FormationBox Class Reference

Description

Builds a box-shaped formation, by computing the position for a specific individual (back-end class).

The shape is primarily based on the number of AgentsPerLine. The first value defines the number of neighboring agents along the x-axis, i.e., the width, while the second value defines the number neighboring agents along the y-axis, i.e., the height. In case the formation is Solid, the agents are placed with a filled center. Otherwise, the agents are placed on the boundary only. In case the Shape is ShapeType.Planar, the formation is build up in a 2D layer, and thus, the second value of AgentsPerLine is ignored. Otherwise, the formation is build in 3D. Note that the last layer may be sparse if the number of available agents does not exactly match the total number of agents defined by AgentsPerLine.

Inheritance diagram for FormationBox:
Formation SteeringBehaviour PerceptBehaviour< SteeringPercept >

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

int size = 1
 Maximum number of agents in the formation. More...
 
int positionInFormation = 0
 Logical position of the agent in the formation, e.g. More...
 
float spacing = 5f
 Distance between each agent in the formation. More...
 
float arriveRadius = 0f
 Radius within the agent slows down to arrive the target position. More...
 
float innerCatchUpRadius = 0f
 Inner radius within the agent keeps its to keep next to the target position. More...
 
float outerCatchUpRadius = 0
 Outer radius within the agent accelerates to keep next to the target position. More...
 
float catchUpMultiplier = 1f
 An additional multiplier to obtain values bigger than the standard magnitude. More...
 
NonInverseMappingType distanceMapping = NonInverseMappingType.Linear
 Specifies the mapping type of the distance from the agent to its target position. More...
 
int layers = 1
 The number of layers to cover agents dynamically (grows in-depth). More...
 
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

TupleInt AgentsPerLine [get, set]
 Number of neighboring agents in width and height of the box-shape. More...
 
bool Solid [get, set]
 Solid or boundary agent placement. More...
 
ShapeType Shape [get, set]
 Shape of the formation. More...
 
Vector3 UpVector [get, set]
 Axis-aligned up vector of the agent according to the attached AIMSensor. More...
 
int Size [get, set]
 Maximum number of agents in the formation. More...
 
int PositionInFormation [get, set]
 Logical position of the agent in the formation, e.g. More...
 
float Spacing [get, set]
 Distance between each agent in the formation. More...
 
float ArriveRadius [get, set]
 Radius within the agent slows down to arrive the target position. More...
 
float InnerCatchUpRadius [get, set]
 Inner radius within the agent keeps its to keep next to the target position. More...
 
float OuterCatchUpRadius [get, set]
 Outer radius within the agent accelerates to keep next to the target position. More...
 
float CatchUpMultiplier [get, set]
 An additional multiplier to obtain values bigger than the standard magnitude. More...
 
NonInverseMappingType DistanceMapping [get, set]
 Specifies the mapping type of the distance from the agent to its target position. More...
 
int Layers [get]
 The number of layers to cover agents dynamically (grows in-depth). More...
 
override bool forEachPercept [get]
 Returns true since only percept steering is supported. More...
 
override bool forEachReceptor [get]
 Returns false since only percept steering is supported. More...
 
override SteeringPercept Self [get, set]
 The data of the associated agent itself. More...
 

Public Methods

override Vector3 ComputePosition ()
 Overwritten method to build up a FormationBox, i.e., placing agents as a box, by computing the AIMFormation.TargetPosition of each agent. More...
 
void UpdateResultPosition ()
 Recomputes and sets the resulting position for the agent in the formation. More...
 
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

override void PerceptSteering ()
 Processes the steering algorithm for each percept using the same data for each processed receptor. More...
 
void ChangeOrientation (Vector3 up, ref Vector3 vec)
 Flips a vector from XY-plane according to an up vector. More...
 
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 ReceptorSteering ()
 This method gets called for each active shape receptor for each processed percept. More...
 
Imprint