Class RayPerceptionSensorComponentBase
A base class to support sensor components for raycast-based sensors.
Inheritance
Inherited Members
Namespace: Unity.MLAgents.Sensors
Syntax
public abstract class RayPerceptionSensorComponentBase : SensorComponent
Fields
m_AlternatingRayOrder
Declaration
[HideInInspector]
[SerializeField]
[Tooltip("Disable to provide the rays in left to right order. Warning: Alternating order will be deprecated, disable it to ensure compatibility with future versions of ML-Agents.")]
public bool m_AlternatingRayOrder
Field Value
Type | Description |
---|---|
Boolean |
Properties
AlternatingRayOrder
Determines how the rays are ordered. By default the ordering is as follows: middle ray is first; then alternates outward adding rays to the left and right. If set to false, then the rays are ordered from left to right (viewed from above) which is more amenable to processing with conv nets. This property will be deprecated with the next major version update and the left to right ordering will be used thereafter.
Declaration
public bool AlternatingRayOrder { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
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 |