Struct RayPerceptionInput
Contains the elements that define a ray perception sensor.
Namespace: Unity.MLAgents.Sensors
Syntax
public struct RayPerceptionInput
Fields
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> Angles
Field 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 CastRadius
Field Value
Type | Description |
---|---|
Single |
CastType
Whether to perform the casts in 2D or 3D.
Declaration
public RayPerceptionCastType CastType
Field Value
Type | Description |
---|---|
RayPerceptionCastType |
DetectableTags
List of tags which correspond to object types agent can see.
Declaration
public IReadOnlyList<string> DetectableTags
Field Value
Type | Description |
---|---|
IReadOnlyList<String> |
EndOffset
Ending height offset of ray from center of agent.
Declaration
public float EndOffset
Field Value
Type | Description |
---|---|
Single |
LayerMask
Filtering options for the casts.
Declaration
public int LayerMask
Field 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 RayLength
Field Value
Type | Description |
---|---|
Single |
StartOffset
Starting height offset of ray from center of agent
Declaration
public float StartOffset
Field Value
Type | Description |
---|---|
Single |
Transform
Transform of the GameObject.
Declaration
public Transform Transform
Field 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. |