Class KaijuCastSensor
KaijuSensor to perform ray or sphere casts. This will cast from this transform in the forward direction of this transform.
Inherited Members
Namespace: KaijuSolutions.Agents.Sensors
Syntax
public class KaijuCastSensor : KaijuSensor
Fields
editorHit
The visualizations color for hits in the editor.
Declaration
public Color editorHit
Field Value
| Type | Description |
|---|---|
| Color |
editorMiss
The visualizations color for misses in the editor.
Declaration
public Color editorMiss
Field Value
| Type | Description |
|---|---|
| Color |
mask
What layers to collide with on the casts.
Declaration
public LayerMask mask
Field Value
| Type | Description |
|---|---|
| LayerMask |
triggers
How casts should handle hitting triggers.
Declaration
public QueryTriggerInteraction triggers
Field Value
| Type | Description |
|---|---|
| QueryTriggerInteraction |
Properties
Angle
What angle to cast along.
Declaration
public float Angle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Casts
The number of casts to make. These will be evenly distributed across the KaijuSolutions.Agents.Sensors.KaijuCastSensor.angle, unless there is only one cast in which case it will cast directly forward.
Declaration
public int Casts { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Distance
How far to cast.
Declaration
public float Distance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Hits
The data from left to right of what the rays have hit, with NULL entries being rays that did not hit.
Declaration
public IReadOnlyList<RaycastHit?> Hits { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyList<System.Nullable<RaycastHit>> |
HitsTotal
The total number of casts which hit something.
Declaration
public int HitsTotal { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Positions
The positions corresponding to the Hits, with Hits that missed being set to the maximum casting distance.
Declaration
public IReadOnlyList<Vector3> Positions { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyList<Vector3> |
Radius
The radius of the casts.
Declaration
public float Radius { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Methods
Cleanup()
Perform any needed resetting of the KaijuSensor.
Declaration
protected override void Cleanup()
Overrides
EditorVisualize(Vector3)
Allow for visualizing in the editor. The position of the Agent.
Declaration
public override void EditorVisualize(Vector3 position)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position |
Overrides
Run()
Run the KaijuSensor.
Declaration
protected override void Run()
Overrides
Operators
Implicit(GameObject to KaijuCastSensor)
Implicit conversion from a GameObject.
Declaration
public static implicit operator KaijuCastSensor(GameObject o)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | o | The GameObject. |
Returns
| Type | Description |
|---|---|
| KaijuCastSensor | The KaijuAgentsVisionSensor attached to the GameObject if there was one. |
Implicit(KaijuCastSensor to KaijuAgent)
Implicit conversion to a KaijuAgent.
Declaration
public static implicit operator KaijuAgent(KaijuCastSensor s)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuCastSensor | s |
Returns
| Type | Description |
|---|---|
| KaijuAgent | The KaijuAgent attached to the KaijuAgentsVisionSensor if there was one. |
Implicit(Transform to KaijuCastSensor)
Implicit conversion from a transform.
Declaration
public static implicit operator KaijuCastSensor(Transform t)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | t | The transform. |
Returns
| Type | Description |
|---|---|
| KaijuCastSensor | The KaijuAgentsVisionSensor attached to the transform if there was one. |