Class GridSensorComponent
A SensorComponent that creates a GridSensorBase.
Inherited Members
Namespace: Unity.MLAgents.Sensors
Assembly: solution.dll
Syntax
[AddComponentMenu("ML Agents/Grid Sensor", 50)]
public class GridSensorComponent : SensorComponent
Fields
| Name | Description |
|---|---|
| m_SensorName |
Properties
| Name | Description |
|---|---|
| AgentGameObject | The reference of the root of the agent. This is used to disambiguate objects with the same tag as the agent. Defaults to current GameObject. |
| CellScale | The scale of each grid cell. Note that changing this after the sensor is created has no effect. |
| ColliderMask | The layer mask. |
| CompressionType | The compression type to use for the sensor. |
| DebugColors | Array of Colors used for the grid gizmos. |
| DetectableTags | List of tags that are detected. Note that changing this after the sensor is created has no effect. |
| GizmoYOffset | The height of the gizmos grid. |
| GridSize | The number of grid on each side. Note that changing this after the sensor is created has no effect. |
| InitialColliderBufferSize | The Estimated Max Number of Colliders to expect per cell. This number is used to pre-allocate an array of Colliders in order to take advantage of the OverlapBoxNonAlloc Physics API. If the number of colliders found is >= InitialColliderBufferSize the array will be resized to double its current size. The hard coded absolute size is 500. Note that changing this after the sensor is created has no effect. |
| MaxColliderBufferSize | The absolute max size of the Collider buffer used in the non-allocating Physics calls. In other words the Collider buffer will never grow beyond this number even if there are more Colliders in the Grid Cell. Note that changing this after the sensor is created has no effect. |
| ObservationStacks | Whether to stack previous observations. Using 1 means no previous observations. Note that changing this after the sensor is created has no effect. |
| RotateWithAgent | Rotate the grid based on the direction the agent is facing. |
| SensorName | Name of the generated GridSensorBase object. Note that changing this at runtime does not affect how the Agent sorts the sensors. |
| ShowGizmos | Whether to show gizmos or not. |
Methods
| Name | Description |
|---|---|
| CreateSensors() | Create the ISensors. This is called by the Agent when it is initialized. |
| GetGridSensors() | Get an array of GridSensors to be added in this component. Override this method and return custom GridSensor implementations. |