Class KaijuObstacleAvoidanceMovement
Obstacle avoidance steering behaviour.
Inherited Members
Namespace: KaijuSolutions.Agents.Movement
Syntax
public class KaijuObstacleAvoidanceMovement : KaijuMovement
Constructors
KaijuObstacleAvoidanceMovement(KaijuAgent, Single, Single, Single, Single, Single, Single, Single)
Create an obstacle avoidance movement.
Declaration
public KaijuObstacleAvoidanceMovement(KaijuAgent agent, float avoidance = 2F, float distance = 5F, float sideDistance = 5F, float angle = 15F, float height = 1F, float horizontal = 0F, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| System.Single | avoidance | The distance from a wall the KaijuAgent should maintain. |
| System.Single | distance | The distance for rays. |
| System.Single | sideDistance | The distance of the side rays. Zero or less will use the Distance. |
| System.Single | angle | The angle for side rays. |
| System.Single | height | The height offset for the rays. |
| System.Single | horizontal | The horizontal shift for the side rays. |
| System.Single | weight | The weight of this KaijuMovement. |
Fields
Angle
The angle for rays.
Declaration
public float Angle
Field Value
| Type | Description |
|---|---|
| System.Single |
DefaultAngle
The default Angle for KaijuObstacleAvoidanceMovements.
Declaration
public const float DefaultAngle = 15F
Field Value
| Type | Description |
|---|---|
| System.Single |
DefaultAvoidance
The default Avoidance for KaijuObstacleAvoidanceMovements.
Declaration
public const float DefaultAvoidance = 2F
Field Value
| Type | Description |
|---|---|
| System.Single |
DefaultDistance
The default Distance for KaijuObstacleAvoidanceMovements.
Declaration
public const float DefaultDistance = 5F
Field Value
| Type | Description |
|---|---|
| System.Single |
DefaultHeight
The default Height for KaijuObstacleAvoidanceMovements.
Declaration
public const float DefaultHeight = 1F
Field Value
| Type | Description |
|---|---|
| System.Single |
DefaultHorizontal
The default Horizontal for KaijuObstacleAvoidanceMovements.
Declaration
public const float DefaultHorizontal = 0F
Field Value
| Type | Description |
|---|---|
| System.Single |
DefaultSideDistance
The default SideDistance for KaijuObstacleAvoidanceMovements.
Declaration
public const float DefaultSideDistance = 0F
Field Value
| Type | Description |
|---|---|
| System.Single |
Height
The height offset for the rays.
Declaration
public float Height
Field Value
| Type | Description |
|---|---|
| System.Single |
Horizontal
The horizontal shift for the side rays.
Declaration
public float Horizontal
Field Value
| Type | Description |
|---|---|
| System.Single |
Mask
While layers the rays should hit.
Declaration
public LayerMask Mask
Field Value
| Type | Description |
|---|---|
| LayerMask |
Properties
Avoidance
The distance from a wall the KaijuAgent should maintain.
Declaration
public float Avoidance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Distance
The distance for rays.
Declaration
public float Distance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Hits
The points hit by the rays.
Declaration
public IReadOnlyList<RaycastHit> Hits { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyList<RaycastHit> |
Misses
All points which were checked to hit but misses.
Declaration
public IReadOnlyList<Vector3> Misses { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyList<Vector3> |
SideDistance
The distance of the side rays. Zero or less will use the Distance.
Declaration
public float SideDistance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Methods
EditorRenderVisualizations(Vector3)
Render the visualization of the KaijuMovement. The position of the Agent.
Declaration
protected override void EditorRenderVisualizations(Vector3 position)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position |
Overrides
EditorVisualizationColor()
Get the color for visualizations.
Declaration
protected override Color EditorVisualizationColor()
Returns
| Type | Description |
|---|---|
| Color | The color for visualizations |
Overrides
Get(KaijuAgent, Single, Single, Single, Single, Single, Single, Single)
Get an obstacle avoidance movement.
Declaration
public static KaijuObstacleAvoidanceMovement Get(KaijuAgent agent, float avoidance = 2F, float distance = 5F, float sideDistance = 5F, float angle = 15F, float height = 1F, float horizontal = 0F, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| System.Single | avoidance | The distance from a wall the KaijuAgent should maintain. |
| System.Single | distance | The distance for rays. |
| System.Single | sideDistance | The distance of the side rays. Zero or less will use the Distance. |
| System.Single | angle | The angle for side rays. |
| System.Single | height | The height offset for the rays. |
| System.Single | horizontal | The horizontal shift for the side rays. |
| System.Single | weight | The weight of this KaijuMovement. |
Returns
| Type | Description |
|---|---|
| KaijuObstacleAvoidanceMovement | Get an obstacle avoidance movement for the KaijuAgent. |
Initialize(KaijuAgent, Single, Single, Single, Single, Single, Single, Single)
Initialize the KaijuMovement.
Declaration
protected void Initialize(KaijuAgent agent, float avoidance = 2F, float distance = 5F, float sideDistance = 5F, float angle = 15F, float height = 1F, float horizontal = 0F, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| System.Single | avoidance | The distance from a wall the KaijuAgent should maintain. |
| System.Single | distance | The distance for rays. |
| System.Single | sideDistance | The distance of the side rays. Zero or less will use the Distance. |
| System.Single | angle | The angle for side rays. |
| System.Single | height | The height offset for the rays. |
| System.Single | horizontal | The horizontal shift for the side rays. |
| System.Single | weight | The weight of this KaijuMovement. |
Move(Vector2, Single)
Get the KaijuMovement.
Declaration
public override Vector2 Move(Vector2 position, float delta)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The position of the Agent. |
| System.Single | delta | The time step. |
Returns
| Type | Description |
|---|---|
| Vector2 | The calculated move vector. |
Overrides
Reset()
Perform any needed reset operations.
Declaration
protected override void Reset()