Class RayPerceptionSensorComponentBase
A base class to support sensor components for raycast-based sensors.
Namespace: Unity.MLAgents.Sensors
Syntax
public abstract class RayPerceptionSensorComponentBase : SensorComponentProperties
DetectableTags
List of tags in the scene to compare against. Note that this should not be changed at runtime.
Declaration
public List<string> DetectableTags { get; set; }Property Value
| Type | Description | 
|---|---|
| List<String> | 
MaxRayDegrees
Cone size for rays. Using 90 degrees will cast rays to the left and right. Greater than 90 degrees will go backwards.
Declaration
public float MaxRayDegrees { get; set; }Property Value
| Type | Description | 
|---|---|
| Single | 
ObservationStacks
Whether to stack previous observations. Using 1 means no previous observations. Note that changing this after the sensor is created has no effect.
Declaration
public int ObservationStacks { get; set; }Property Value
| Type | Description | 
|---|---|
| Int32 | 
RayLayerMask
Controls which layers the rays can hit.
Declaration
public LayerMask RayLayerMask { get; set; }Property Value
| Type | Description | 
|---|---|
| LayerMask | 
RayLength
Length of the rays to cast.
Declaration
public float RayLength { get; set; }Property Value
| Type | Description | 
|---|---|
| Single | 
RaySensor
Get the RayPerceptionSensor that was created.
Declaration
public RayPerceptionSensor RaySensor { get; }Property Value
| Type | Description | 
|---|---|
| RayPerceptionSensor | 
RaysPerDirection
Number of rays to the left and right of center. Note that this should not be changed at runtime.
Declaration
public int RaysPerDirection { get; set; }Property Value
| Type | Description | 
|---|---|
| Int32 | 
SensorName
The name of the Sensor that this component wraps. Note that changing this at runtime does not affect how the Agent sorts the sensors.
Declaration
public string SensorName { get; set; }Property Value
| Type | Description | 
|---|---|
| String | 
SphereCastRadius
Radius of sphere to cast. Set to zero for raycasts.
Declaration
public float SphereCastRadius { get; set; }Property Value
| Type | Description | 
|---|---|
| Single | 
Methods
CreateSensors()
Returns an initialized raycast sensor.
Declaration
public override ISensor[] CreateSensors()Returns
| Type | Description | 
|---|---|
| ISensor[] | 
Overrides
GetCastType()
Returns the RayPerceptionCastType for the associated raycast sensor.
Declaration
public abstract RayPerceptionCastType GetCastType()Returns
| Type | Description | 
|---|---|
| RayPerceptionCastType | 
GetEndVerticalOffset()
Returns the amount that the ray end is offset up or down by.
Declaration
public virtual float GetEndVerticalOffset()Returns
| Type | Description | 
|---|---|
| Single | 
GetRayPerceptionInput()
Get the RayPerceptionInput that is used by the RayPerceptionSensor.
Declaration
public RayPerceptionInput GetRayPerceptionInput()Returns
| Type | Description | 
|---|---|
| RayPerceptionInput | 
GetStartVerticalOffset()
Returns the amount that the ray start is offset up or down by.
Declaration
public virtual float GetStartVerticalOffset()Returns
| Type | Description | 
|---|---|
| Single |