Struct RayPerceptionInput
Contains the elements that define a ray perception sensor.
Namespace: Unity.MLAgents.Sensors
Syntax
public struct RayPerceptionInputFields
Angles
List of angles (in degrees) used to define the rays. 90 degrees is considered "forward" relative to the game object.
Declaration
public IReadOnlyList<float> AnglesField Value
| Type | Description | 
|---|---|
| IReadOnlyList<Single> | 
CastRadius
Radius of the sphere to use for spherecasting. If 0 or less, rays are used instead - this may be faster, especially for complex environments.
Declaration
public float CastRadiusField Value
| Type | Description | 
|---|---|
| Single | 
CastType
Whether to perform the casts in 2D or 3D.
Declaration
public RayPerceptionCastType CastTypeField Value
| Type | Description | 
|---|---|
| RayPerceptionCastType | 
DetectableTags
List of tags which correspond to object types agent can see.
Declaration
public IReadOnlyList<string> DetectableTagsField Value
| Type | Description | 
|---|---|
| IReadOnlyList<String> | 
EndOffset
Ending height offset of ray from center of agent.
Declaration
public float EndOffsetField Value
| Type | Description | 
|---|---|
| Single | 
LayerMask
Filtering options for the casts.
Declaration
public int LayerMaskField Value
| Type | Description | 
|---|---|
| Int32 | 
RayLength
Length of the rays to cast. This will be scaled up or down based on the scale of the transform.
Declaration
public float RayLengthField Value
| Type | Description | 
|---|---|
| Single | 
StartOffset
Starting height offset of ray from center of agent
Declaration
public float StartOffsetField Value
| Type | Description | 
|---|---|
| Single | 
Transform
Transform of the GameObject.
Declaration
public Transform TransformField Value
| Type | Description | 
|---|---|
| Transform | 
Methods
OutputSize()
Returns the expected number of floats in the output.
Declaration
public int OutputSize()Returns
| Type | Description | 
|---|---|
| Int32 | 
RayExtents(Int32)
Get the cast start and end points for the given ray index/
Declaration
public (Vector3 StartPositionWorld, Vector3 EndPositionWorld) RayExtents(int rayIndex)Parameters
| Type | Name | Description | 
|---|---|---|
| Int32 | rayIndex | 
Returns
| Type | Description | 
|---|---|
| ValueTuple<Vector3, Vector3> | A tuple of the start and end positions in world space. |