浏览代码

Separate boxoverlap out of GridSensor (#5238)

/check-for-ModelOverriders
GitHub 4 年前
当前提交
ca2f0b78
共有 37 个文件被更改,包括 2560 次插入1315 次删除
  1. 50
      Project/Assets/ML-Agents/Examples/FoodCollector/Prefabs/FoodCollectorArea.prefab
  2. 276
      Project/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockCollabAreaGrid.prefab
  3. 172
      Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlockCollab.unity
  4. 995
      Project/Assets/ML-Agents/Examples/PushBlock/TFModels/PushBlockCollab.onnx
  5. 8
      Project/Assets/ML-Agents/Examples/PushBlock/TFModels/PushBlockCollab.onnx.meta
  6. 50
      com.unity.ml-agents.extensions/Editor/GridSensorComponentEditor.cs
  7. 158
      com.unity.ml-agents.extensions/Runtime/Sensors/GridSensorComponent.cs
  8. 2
      com.unity.ml-agents.extensions/Runtime/Sensors/BoxOverlapChecker.cs.meta
  9. 2
      com.unity.ml-agents.extensions/Tests/Editor/GridSensors/BoxOverlapCheckerTests.cs.meta
  10. 2
      com.unity.ml-agents.extensions/Tests/Editor/GridSensors/GridSensorTests.cs.meta
  11. 2
      com.unity.ml-agents.extensions/Runtime/Sensors/CountingGridSensor.cs.meta
  12. 2
      com.unity.ml-agents.extensions/Runtime/Sensors/GridSensorBase.cs.meta
  13. 2
      com.unity.ml-agents.extensions/Runtime/Sensors/OneHotGridSensor.cs.meta
  14. 2
      com.unity.ml-agents.extensions/Tests/Editor/GridSensors/SimpleTestGridSensor.cs.meta
  15. 254
      com.unity.ml-agents.extensions/Runtime/Sensors/BoxOverlapChecker.cs
  16. 61
      com.unity.ml-agents.extensions/Runtime/Sensors/CountingGridSensor.cs
  17. 366
      com.unity.ml-agents.extensions/Runtime/Sensors/GridSensorBase.cs
  18. 60
      com.unity.ml-agents.extensions/Runtime/Sensors/OneHotGridSensor.cs
  19. 8
      com.unity.ml-agents.extensions/Tests/Editor/GridSensors.meta
  20. 297
      com.unity.ml-agents.extensions/Tests/Editor/GridSensors/BoxOverlapCheckerTests.cs
  21. 88
      com.unity.ml-agents.extensions/Tests/Editor/GridSensors/GridSensorTestUtils.cs
  22. 210
      com.unity.ml-agents.extensions/Tests/Editor/GridSensors/GridSensorTests.cs
  23. 131
      com.unity.ml-agents.extensions/Tests/Editor/GridSensors/SimpleTestGridSensor.cs
  24. 661
      com.unity.ml-agents.extensions/Runtime/Sensors/GridSensor.cs
  25. 8
      com.unity.ml-agents.extensions/Tests/Editor/Sensors.meta
  26. 8
      com.unity.ml-agents.extensions/Tests/Utils.meta
  27. 0
      /com.unity.ml-agents.extensions/Runtime/Sensors/BoxOverlapChecker.cs.meta
  28. 0
      /com.unity.ml-agents.extensions/Tests/Editor/GridSensors/BoxOverlapCheckerTests.cs.meta
  29. 0
      /com.unity.ml-agents.extensions/Tests/Editor/GridSensors/GridSensorTests.cs.meta
  30. 0
      /com.unity.ml-agents.extensions/Runtime/Sensors/CountingGridSensor.cs.meta
  31. 0
      /com.unity.ml-agents.extensions/Runtime/Sensors/GridSensorBase.cs.meta
  32. 0
      /com.unity.ml-agents.extensions/Runtime/Sensors/OneHotGridSensor.cs.meta
  33. 0
      /com.unity.ml-agents.extensions/Tests/Editor/GridSensors/GridSensorTestUtils.cs.meta
  34. 0
      /com.unity.ml-agents.extensions/Tests/Editor/GridSensors/SimpleTestGridSensor.cs.meta

50
Project/Assets/ML-Agents/Examples/FoodCollector/Prefabs/FoodCollectorArea.prefab


- component: {fileID: 114176228333253036}
- component: {fileID: 8297075921230369060}
- component: {fileID: 1222199865870203693}
- component: {fileID: 2010492400}
- component: {fileID: 2106566910232743969}
m_Layer: 0
m_Name: Agent
m_TagString: agent

m_Name:
m_EditorClassIdentifier:
debugCommandLineOverride:
--- !u!114 &2010492400
--- !u!114 &2106566910232743969
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_CellScale: {x: 1, y: 0.01, z: 1}
m_GridSize: {x: 40, y: 1, z: 40}
m_RotateWithAgent: 1
m_ChannelDepths: 05000000
m_DetectableObjects:
m_DetectableTags:
- food
- agent
- wall

serializedVersion: 2
m_Bits: 307
m_DepthType: 1
m_MaxColliderBufferSize: 500
m_InitialColliderBufferSize: 4
m_DebugColors:

m_ShowGizmos: 0
m_CompressionType: 1
m_ObservationStacks: 1
m_UseOneHotTag: 1
m_CountColliders: 0
--- !u!1 &1482701732800114
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 114522573150607728}
- component: {fileID: 114711827726849508}
- component: {fileID: 259154752087955944}
- component: {fileID: 7409303125559953495}
- component: {fileID: 556732721703992837}
m_Layer: 0
m_Name: Agent (1)
m_TagString: agent

m_EditorClassIdentifier:
DecisionPeriod: 5
TakeActionsBetweenDecisions: 1
--- !u!114 &7409303125559953495
--- !u!114 &556732721703992837
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_CellScale: {x: 1, y: 0.01, z: 1}
m_GridSize: {x: 40, y: 1, z: 40}
m_RotateWithAgent: 1
m_ChannelDepths: 05000000
m_DetectableObjects:
m_DetectableTags:
- food
- agent
- wall

serializedVersion: 2
m_Bits: 307
m_DepthType: 1
m_MaxColliderBufferSize: 500
m_InitialColliderBufferSize: 4
m_DebugColors:

m_ShowGizmos: 0
m_CompressionType: 1
m_ObservationStacks: 1
m_UseOneHotTag: 1
m_CountColliders: 0
--- !u!1 &1528397385587768
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 114980787530065684}
- component: {fileID: 114542632553128056}
- component: {fileID: 5519119940433428255}
- component: {fileID: 1115669858669834387}
- component: {fileID: 1408842157152425307}
m_Layer: 0
m_Name: Agent (2)
m_TagString: agent

m_EditorClassIdentifier:
DecisionPeriod: 5
TakeActionsBetweenDecisions: 1
--- !u!114 &1115669858669834387
--- !u!114 &1408842157152425307
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_CellScale: {x: 1, y: 0.01, z: 1}
m_GridSize: {x: 40, y: 1, z: 40}
m_RotateWithAgent: 1
m_ChannelDepths: 05000000
m_DetectableObjects:
m_DetectableTags:
- food
- agent
- wall

serializedVersion: 2
m_Bits: 307
m_DepthType: 1
m_MaxColliderBufferSize: 500
m_InitialColliderBufferSize: 4
m_DebugColors:

m_ShowGizmos: 0
m_CompressionType: 1
m_ObservationStacks: 1
m_UseOneHotTag: 1
m_CountColliders: 0
--- !u!1 &1617924810425504
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 114878550018296316}
- component: {fileID: 114189751434580810}
- component: {fileID: 5884750436653390196}
- component: {fileID: 3147256093106034163}
- component: {fileID: 455231854019269609}
m_Layer: 0
m_Name: Agent (4)
m_TagString: agent

m_EditorClassIdentifier:
DecisionPeriod: 5
TakeActionsBetweenDecisions: 1
--- !u!114 &3147256093106034163
--- !u!114 &455231854019269609
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_CellScale: {x: 1, y: 0.01, z: 1}
m_GridSize: {x: 40, y: 1, z: 40}
m_RotateWithAgent: 1
m_ChannelDepths: 05000000
m_DetectableObjects:
m_DetectableTags:
- food
- agent
- wall

serializedVersion: 2
m_Bits: 307
m_DepthType: 1
m_MaxColliderBufferSize: 500
m_InitialColliderBufferSize: 4
m_DebugColors:

m_ShowGizmos: 0
m_CompressionType: 1
m_ObservationStacks: 1
m_UseOneHotTag: 1
m_CountColliders: 0
--- !u!1 &1688105343773098
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 114035338027591536}
- component: {fileID: 114235147148547996}
- component: {fileID: 4768752321433982785}
- component: {fileID: 3712017990468381030}
- component: {fileID: 653284020512459243}
m_Layer: 0
m_Name: Agent (3)
m_TagString: agent

m_EditorClassIdentifier:
DecisionPeriod: 5
TakeActionsBetweenDecisions: 1
--- !u!114 &3712017990468381030
--- !u!114 &653284020512459243
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_CellScale: {x: 1, y: 0.01, z: 1}
m_GridSize: {x: 40, y: 1, z: 40}
m_RotateWithAgent: 1
m_ChannelDepths: 05000000
m_DetectableObjects:
m_DetectableTags:
- food
- agent
- wall

serializedVersion: 2
m_Bits: 307
m_DepthType: 1
m_MaxColliderBufferSize: 500
m_InitialColliderBufferSize: 4
m_DebugColors:

m_ShowGizmos: 0
m_CompressionType: 1
m_ObservationStacks: 1
m_UseOneHotTag: 1
m_CountColliders: 0
--- !u!1 &1729825611722018
GameObject:
m_ObjectHideFlags: 0

276
Project/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockCollabAreaGrid.prefab


m_GameObject: {fileID: 1679953550419902237}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0

m_GameObject: {fileID: 1704950560014369677}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []

m_GameObject: {fileID: 2077722060465813602}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []

m_GameObject: {fileID: 4230455278956278417}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []

m_GameObject: {fileID: 4880170283005485334}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []

m_GameObject: {fileID: 5377521765718574666}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0

m_GameObject: {fileID: 5488091025762841109}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0

m_GameObject: {fileID: 5841039003968194311}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0

m_GameObject: {fileID: 5867018048826954104}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []

m_GameObject: {fileID: 6108224887597176060}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0

m_GameObject: {fileID: 6799730675784402451}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

onTriggerExitEvent:
m_PersistentCalls:
m_Calls: []
--- !u!114 &1809664679221531284
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8191066182862526894}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a501962d056745d1a30e99146ee39fe, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SensorName: GridSensor
m_CellScale: {x: 1, y: 0.01, z: 1}
m_GridSize: {x: 20, y: 1, z: 20}
m_RotateWithAgent: 1
m_DetectableTags:
- wall
- agent
- goal
- blockSmall
- blockLarge
- blockVeryLarge
m_ColliderMask:
serializedVersion: 2
m_Bits: 1
m_MaxColliderBufferSize: 500
m_InitialColliderBufferSize: 16
m_DebugColors:
- {r: 0, g: 0, b: 0, a: 0}
- {r: 0, g: 0.5176471, b: 1, a: 0}
- {r: 0.46666667, g: 0.7058824, b: 0.3529412, a: 0}
- {r: 1, g: 0.99607843, b: 0.9843137, a: 0}
- {r: 0.48235294, g: 0.48235294, b: 0.48235294, a: 0}
- {r: 0.35686275, g: 0.35686275, b: 0.35686275, a: 0}
m_GizmoYOffset: 0
m_ShowGizmos: 0
m_CompressionType: 1
m_ObservationStacks: 1
m_UseOneHotTag: 1
m_CountColliders: 0
--- !u!1 &8191066182918326564
GameObject:
m_ObjectHideFlags: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

UseRandomAgentPosition: 1
UseRandomBlockRotation: 1
UseRandomBlockPosition: 1
--- !u!114 &4609315540733531199
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8696048509000480032}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a501962d056745d1a30e99146ee39fe, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SensorName: GridSensor
m_CellScale: {x: 1, y: 0.01, z: 1}
m_GridSize: {x: 20, y: 1, z: 20}
m_RotateWithAgent: 1
m_DetectableTags:
- wall
- agent
- goal
- blockSmall
- blockLarge
- blockVeryLarge
m_ColliderMask:
serializedVersion: 2
m_Bits: 1
m_MaxColliderBufferSize: 500
m_InitialColliderBufferSize: 16
m_DebugColors:
- {r: 0, g: 0, b: 0, a: 0}
- {r: 0, g: 0.5176471, b: 1, a: 0}
- {r: 0.46666667, g: 0.7058824, b: 0.3529412, a: 0}
- {r: 1, g: 0.99607843, b: 0.9843137, a: 0}
- {r: 0.48235294, g: 0.48235294, b: 0.48235294, a: 0}
- {r: 0.35686275, g: 0.35686275, b: 0.35686275, a: 0}
m_GizmoYOffset: 0
m_ShowGizmos: 0
m_CompressionType: 1
m_ObservationStacks: 1
m_UseOneHotTag: 1
m_CountColliders: 0
--- !u!1 &8821353056066081524
GameObject:
m_ObjectHideFlags: 0

m_GameObject: {fileID: 8821353056066081524}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0

m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &6319243058783963332
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9116780590443581137}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a501962d056745d1a30e99146ee39fe, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SensorName: GridSensor
m_CellScale: {x: 1, y: 0.01, z: 1}
m_GridSize: {x: 20, y: 1, z: 20}
m_RotateWithAgent: 1
m_DetectableTags:
- wall
- agent
- goal
- blockSmall
- blockLarge
- blockVeryLarge
m_ColliderMask:
serializedVersion: 2
m_Bits: 1
m_MaxColliderBufferSize: 500
m_InitialColliderBufferSize: 16
m_DebugColors:
- {r: 0, g: 0, b: 0, a: 0}
- {r: 0, g: 0.5176471, b: 1, a: 0}
- {r: 0.46666667, g: 0.7058824, b: 0.3529412, a: 0}
- {r: 1, g: 0.99607843, b: 0.9843137, a: 0}
- {r: 0.48235294, g: 0.48235294, b: 0.48235294, a: 0}
- {r: 0.35686275, g: 0.35686275, b: 0.35686275, a: 0}
m_GizmoYOffset: 0
m_ShowGizmos: 0
m_CompressionType: 1
m_ObservationStacks: 1
m_UseOneHotTag: 1
m_CountColliders: 0
--- !u!1001 &6067781793364901444
PrefabInstance:
m_ObjectHideFlags: 0

m_Modifications:
- target: {fileID: 2598450485826216109, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_Model
value:
objectReference: {fileID: 5022602860645237092, guid: c3aafa29d87154882bcb52488c6446ec,
type: 3}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalPosition.x

objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalRotation.x
propertyPath: m_LocalRotation.w
propertyPath: m_LocalRotation.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalRotation.z
propertyPath: m_LocalRotation.x
propertyPath: m_LocalRotation.w
value: 0
propertyPath: m_LocalRotation.y
value: 1
propertyPath: m_RootOrder
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,

propertyPath: m_Name
value: PushBlockAgentGridCollab
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 2709359580712052712, guid: ac01d0f42c5e1463e943632a60d99967, type: 3}
--- !u!1 &8191066182862526894 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2709359580712052714, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
m_PrefabInstance: {fileID: 6067781793364901444}
m_PrefabAsset: {fileID: 0}
--- !u!114 &8190299122290044756 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 2710286047221272848, guid: ac01d0f42c5e1463e943632a60d99967,

m_Modification:
m_TransformParent: {fileID: 8188317207052398481}
m_Modifications:
- target: {fileID: 2598450485826216109, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_Model
value:
objectReference: {fileID: 5022602860645237092, guid: c3aafa29d87154882bcb52488c6446ec,
type: 3}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalPosition.x

type: 3}
propertyPath: m_LocalPosition.z
value: 9.21
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalRotation.w
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}

objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalRotation.w
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}

propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: b0da1813c36914e678ba57f2790424e1, type: 2}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 2709359580712052712, guid: ac01d0f42c5e1463e943632a60d99967, type: 3}
--- !u!1 &9116780590443581137 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2709359580712052714, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
m_PrefabInstance: {fileID: 6565363751102736699}
m_PrefabAsset: {fileID: 0}
--- !u!114 &9115291448867436587 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 2710286047221272848, guid: ac01d0f42c5e1463e943632a60d99967,

m_Modification:
m_TransformParent: {fileID: 8188317207052398481}
m_Modifications:
- target: {fileID: 2598450485826216109, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_Model
value:
objectReference: {fileID: 5022602860645237092, guid: c3aafa29d87154882bcb52488c6446ec,
type: 3}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalPosition.x

type: 3}
propertyPath: m_LocalPosition.z
value: 9.21
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalRotation.w
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}

objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalRotation.w
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2708762399863795223, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}

propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 52eab8ab5010f438fab93da85735ba1d, type: 2}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 2709359580712052712, guid: ac01d0f42c5e1463e943632a60d99967, type: 3}
--- !u!1 &8696048509000480032 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2709359580712052714, guid: ac01d0f42c5e1463e943632a60d99967,
type: 3}
m_PrefabInstance: {fileID: 6716844123244810954}
m_PrefabAsset: {fileID: 0}
--- !u!114 &8695281997955662810 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 2710286047221272848, guid: ac01d0f42c5e1463e943632a60d99967,

172
Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlockCollab.unity


m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 10
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024

m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1

m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilteringMode: 1
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5

m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 112000002, guid: 03723c7f910c3423aa1974f1b9ce8392,
type: 2}
m_UseShadowmask: 1

m_GameObject: {fileID: 255077123}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal

m_GameObject: {fileID: 255077123}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}

m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4943719350691982, guid: 5889392e3f05b448a8a06c5def6c2dec, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 4943719350691982, guid: 5889392e3f05b448a8a06c5def6c2dec, type: 3}
propertyPath: m_LocalPosition.x
value: 106.38621
objectReference: {fileID: 0}

value: 34.72934
objectReference: {fileID: 0}
- target: {fileID: 4943719350691982, guid: 5889392e3f05b448a8a06c5def6c2dec, type: 3}
propertyPath: m_LocalRotation.w
value: 0.8681629
objectReference: {fileID: 0}
- target: {fileID: 4943719350691982, guid: 5889392e3f05b448a8a06c5def6c2dec, type: 3}
propertyPath: m_LocalRotation.x
value: 0.31598538
objectReference: {fileID: 0}

propertyPath: m_LocalRotation.z
value: 0.13088542
objectReference: {fileID: 0}
- target: {fileID: 4943719350691982, guid: 5889392e3f05b448a8a06c5def6c2dec, type: 3}
propertyPath: m_LocalRotation.w
value: 0.8681629
objectReference: {fileID: 0}
- target: {fileID: 4943719350691982, guid: 5889392e3f05b448a8a06c5def6c2dec, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5889392e3f05b448a8a06c5def6c2dec, type: 3}
--- !u!1 &1009000883

m_ClearFlags: 2
m_BackGroundColor: {r: 0.46666667, g: 0.5647059, b: 0.60784316, a: 1}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2

m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_RootOrder
value: 9
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalPosition.x

objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}

type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_RootOrder
value: 9
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}

m_Modifications:
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}

objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}

objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}

type: 3}
propertyPath: m_Name
value: PushBlockCollabAreaGrid (1)
objectReference: {fileID: 0}
- target: {fileID: 8191903532335653025, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f5bbed44a6ea747a687fbbb738eb1730, type: 3}

m_Modifications:
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_RootOrder
value: 8
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}

objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}

objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_RootOrder
value: 8
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}

m_Modifications:
- target: {fileID: 224194346362733190, guid: 3ce107b4a79bc4eef83afde434932a68,
type: 3}
propertyPath: m_LocalPosition.x
propertyPath: m_Pivot.x
propertyPath: m_LocalPosition.y
propertyPath: m_Pivot.y
propertyPath: m_LocalPosition.z
value: 0
propertyPath: m_RootOrder
value: 3
propertyPath: m_LocalRotation.x
propertyPath: m_AnchorMax.x
propertyPath: m_LocalRotation.y
propertyPath: m_AnchorMax.y
propertyPath: m_LocalRotation.z
propertyPath: m_AnchorMin.x
propertyPath: m_LocalRotation.w
value: 1
propertyPath: m_AnchorMin.y
value: 0
propertyPath: m_RootOrder
value: 3
propertyPath: m_SizeDelta.x
value: 0
propertyPath: m_AnchoredPosition.x
propertyPath: m_SizeDelta.y
propertyPath: m_AnchoredPosition.y
propertyPath: m_LocalPosition.x
propertyPath: m_SizeDelta.x
propertyPath: m_LocalPosition.y
propertyPath: m_SizeDelta.y
propertyPath: m_LocalPosition.z
propertyPath: m_AnchorMin.x
value: 0
propertyPath: m_LocalRotation.w
value: 1
propertyPath: m_AnchorMin.y
propertyPath: m_LocalRotation.x
propertyPath: m_AnchorMax.x
propertyPath: m_LocalRotation.y
propertyPath: m_AnchorMax.y
propertyPath: m_LocalRotation.z
propertyPath: m_Pivot.x
propertyPath: m_AnchoredPosition.x
propertyPath: m_Pivot.y
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []

m_Modifications:
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}

type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}

objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}

- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8191066182862526892, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: ShowGizmos
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8191903532335653025, guid: f5bbed44a6ea747a687fbbb738eb1730,

995
Project/Assets/ML-Agents/Examples/PushBlock/TFModels/PushBlockCollab.onnx
文件差异内容过多而无法显示
查看文件

8
Project/Assets/ML-Agents/Examples/PushBlock/TFModels/PushBlockCollab.onnx.meta


fileFormatVersion: 2
guid: e35859736a42e4342b3272438be93ea9
guid: c3aafa29d87154882bcb52488c6446ec
fileIDToRecycleName:
11400000: main obj
11400002: model data
internalIDToNameTable: []
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:

treatErrorsAsWarnings: 0
importMode: 1

50
com.unity.ml-agents.extensions/Editor/GridSensorComponentEditor.cs


EditorGUI.BeginDisabledGroup(!EditorUtilities.CanUpdateModelProperties());
{
EditorGUILayout.LabelField("Channel Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_DepthType)), true);
// channel depth
var channelDepth = so.FindProperty(nameof(GridSensorComponent.m_ChannelDepths));
var newDepth = EditorGUILayout.IntField("Channel Depth", channelDepth.arraySize);
if (newDepth != channelDepth.arraySize)
{
channelDepth.arraySize = newDepth;
}
EditorGUI.indentLevel++;
for (var i = 0; i < channelDepth.arraySize; i++)
{
var objectTag = channelDepth.GetArrayElementAtIndex(i);
EditorGUILayout.PropertyField(objectTag, new GUIContent("Channel " + i + " Depth"), true);
}
EditorGUI.indentLevel--;
// detectable objects
var detectableObjects = so.FindProperty(nameof(GridSensorComponent.m_DetectableObjects));
var newSize = EditorGUILayout.IntField("Detectable Objects", detectableObjects.arraySize);
if (newSize != detectableObjects.arraySize)
// detectable tags
var detectableTags = so.FindProperty(nameof(GridSensorComponent.m_DetectableTags));
var newSize = EditorGUILayout.IntField("Detectable Tags", detectableTags.arraySize);
if (newSize != detectableTags.arraySize)
detectableObjects.arraySize = newSize;
detectableTags.arraySize = newSize;
for (var i = 0; i < detectableObjects.arraySize; i++)
for (var i = 0; i < detectableTags.arraySize; i++)
var objectTag = detectableObjects.GetArrayElementAtIndex(i);
var objectTag = detectableTags.GetArrayElementAtIndex(i);
EditorGUILayout.LabelField("Collider and Buffer", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_MaxColliderBufferSize)), true);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_InitialColliderBufferSize)), true);
EditorGUILayout.LabelField("Observation Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_UseOneHotTag)), new GUIContent("One-Hot Tag Index"), true);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_CountColliders)), new GUIContent("Detectable Tag Count"), true);
EditorGUILayout.LabelField("Sensor Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_ObservationStacks)), true);
EditorGUI.EndDisabledGroup();
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_CompressionType)), true);
EditorGUILayout.LabelField("Sensor Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_ObservationStacks)), true);
EditorGUILayout.LabelField("Collider and Buffer", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_InitialColliderBufferSize)), true);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_MaxColliderBufferSize)), true);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_CompressionType)), true);
EditorGUILayout.LabelField("Debug Gizmo", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(so.FindProperty(nameof(GridSensorComponent.m_ShowGizmos)), true);

var debugColors = so.FindProperty(nameof(GridSensorComponent.m_DebugColors));
var detectableObjectSize = so.FindProperty(nameof(GridSensorComponent.m_DetectableObjects)).arraySize;
var detectableObjectSize = so.FindProperty(nameof(GridSensorComponent.m_DetectableTags)).arraySize;
if (detectableObjectSize != debugColors.arraySize)
{
debugColors.arraySize = detectableObjectSize;

158
com.unity.ml-agents.extensions/Runtime/Sensors/GridSensorComponent.cs


using System.Collections.Generic;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.EditorTests")]
namespace Unity.MLAgents.Extensions.Sensors
{
/// <summary>

public class GridSensorComponent : SensorComponent
{
protected GridSensor m_Sensor;
// dummy sensor only used for debug gizmo
GridSensorBase m_DebugSensor;
List<ISensor> m_Sensors;
internal BoxOverlapChecker m_BoxOverlapChecker;
// <summary>
/// <summary>
/// Name of the generated <see cref="GridSensor"/> object.
/// Note that changing this at runtime does not affect how the Agent sorts the sensors.
/// </summary>

}
[HideInInspector, SerializeField]
internal int[] m_ChannelDepths = new int[] { 1 };
/// <summary>
/// Array holding the depth of each channel.
/// Note that changing this after the sensor is created has no effect.
/// </summary>
public int[] ChannelDepths
{
get { return m_ChannelDepths; }
set { m_ChannelDepths = value; }
}
[HideInInspector, SerializeField]
internal string[] m_DetectableObjects;
internal string[] m_DetectableTags;
public string[] DetectableObjects
public string[] DetectableTags
get { return m_DetectableObjects; }
set { m_DetectableObjects = value; }
get { return m_DetectableTags; }
set { m_DetectableTags = value; }
}
[HideInInspector, SerializeField]

}
[HideInInspector, SerializeField]
internal GridDepthType m_DepthType = GridDepthType.Channel;
/// <summary>
/// The data layout that the grid should output.
/// Note that changing this after the sensor is created has no effect.
/// </summary>
public GridDepthType DepthType
{
get { return m_DepthType; }
set { m_DepthType = value; }
}
[HideInInspector, SerializeField]
internal int m_MaxColliderBufferSize = 500;
/// <summary>
/// The absolute max size of the Collider buffer used in the non-allocating Physics calls. In other words

set { m_ObservationStacks = value; }
}
[HideInInspector, SerializeField]
internal bool m_UseOneHotTag = true;
/// <summary>
/// Whether to use one-hot representation of detected tag as observation.
/// Note that changing this after the sensor is created has no effect.
/// </summary>
public bool UseOneHotTag
{
get { return m_UseOneHotTag; }
set { m_UseOneHotTag = value; }
}
[HideInInspector, SerializeField]
internal bool m_CountColliders = false;
/// <summary>
/// Whether to use the number of count for each detectable tag as observation.
/// Note that changing this after the sensor is created has no effect.
/// </summary>
public bool CountColliders
{
get { return m_CountColliders; }
set { m_CountColliders = value; }
}
m_Sensor = new GridSensor(
m_SensorName,
List<ISensor> m_Sensors = new List<ISensor>();
m_BoxOverlapChecker = new BoxOverlapChecker(
m_ChannelDepths,
m_DetectableObjects,
m_DepthType,
m_CompressionType,
m_MaxColliderBufferSize,
m_InitialColliderBufferSize
m_DetectableTags,
m_InitialColliderBufferSize,
m_MaxColliderBufferSize
if (ObservationStacks != 1)
// debug data is positive int value and will trigger data validation exception if SensorCompressionType is not None.
m_DebugSensor = new GridSensorBase("DebugGridSensor", m_CellScale, m_GridSize, m_DetectableTags, SensorCompressionType.None);
m_BoxOverlapChecker.RegisterDebugSensor(m_DebugSensor);
var gridSensors = GetGridSensors();
if (gridSensors == null || gridSensors.Length < 1)
{
throw new UnityAgentsException("GridSensorComponent received no sensors. Specify at least one observation type (OneHot/Counting) to use grid sensors." +
"If you're overriding GridSensorComponent.GetGridSensors(), return at least one grid sensor.");
}
foreach (var sensor in gridSensors)
{
if (ObservationStacks != 1)
{
m_Sensors.Add(new StackingSensor(sensor, ObservationStacks));
}
else
{
m_Sensors.Add(sensor);
}
m_BoxOverlapChecker.RegisterSensor(sensor);
}
// Only one sensor needs to reference the boxOverlapChecker, so that it gets updated exactly once
((GridSensorBase)m_Sensors[0]).m_BoxOverlapChecker = m_BoxOverlapChecker;
return m_Sensors.ToArray();
}
/// <summary>
/// Get an array of GridSensors to be added in this component.
/// Override this method and return custom GridSensor implementations.
/// </summary>
/// <returns>Array of grid sensors to be added to the component.</returns>
protected virtual GridSensorBase[] GetGridSensors()
{
List<GridSensorBase> sensorList = new List<GridSensorBase>();
if (m_UseOneHotTag)
{
var sensor = new OneHotGridSensor(m_SensorName + "-OneHot", m_CellScale, m_GridSize, m_DetectableTags, m_CompressionType);
sensorList.Add(sensor);
}
if (m_CountColliders)
return new ISensor[] { new StackingSensor(m_Sensor, ObservationStacks) };
var sensor = new CountingGridSensor(m_SensorName + "-Counting", m_CellScale, m_GridSize, m_DetectableTags, m_CompressionType);
sensorList.Add(sensor);
return new ISensor[] { m_Sensor };
return sensorList.ToArray();
}
/// <summary>

{
if (m_Sensor != null)
if (m_Sensors != null)
m_Sensor.CompressionType = m_CompressionType;
m_Sensor.RotateWithAgent = m_RotateWithAgent;
m_Sensor.ColliderMask = m_ColliderMask;
m_BoxOverlapChecker.RotateWithAgent = m_RotateWithAgent;
m_BoxOverlapChecker.ColliderMask = m_ColliderMask;
foreach (var sensor in m_Sensors)
{
((GridSensorBase)sensor).CompressionType = m_CompressionType;
}
}
}

{
if (m_Sensor == null)
if (m_BoxOverlapChecker == null || m_DebugSensor == null)
var cellColors = m_Sensor.PerceiveGizmoColor();
var cellPositions = m_Sensor.GetGizmoPositions();
var rotation = m_Sensor.GetGridRotation();
m_DebugSensor.ResetPerceptionBuffer();
m_BoxOverlapChecker.UpdateGizmo();
var cellColors = m_DebugSensor.PerceptionBuffer;
var rotation = m_BoxOverlapChecker.GetGridRotation();
for (var i = 0; i < cellPositions.Length; i++)
for (var i = 0; i < m_DebugSensor.PerceptionBuffer.Length; i++)
var cubeTransform = Matrix4x4.TRS(cellPositions[i] + gizmoYOffset, rotation, scale);
var cellPosition = m_BoxOverlapChecker.GetCellGlobalPosition(i);
var cubeTransform = Matrix4x4.TRS(cellPosition + gizmoYOffset, rotation, scale);
var colorIndex = cellColors[i];
var colorIndex = cellColors[i] - 1;
debugRayColor = m_DebugColors[colorIndex];
debugRayColor = m_DebugColors[(int)colorIndex];
}
Gizmos.color = new Color(debugRayColor.r, debugRayColor.g, debugRayColor.b, .5f);
Gizmos.DrawCube(Vector3.zero, Vector3.one);

2
com.unity.ml-agents.extensions/Runtime/Sensors/BoxOverlapChecker.cs.meta


fileFormatVersion: 2
guid: 801669c0cdece6b40b2e741ad0b119ac
guid: e039296229a084578823e21bce9cf834
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Tests/Editor/GridSensors/BoxOverlapCheckerTests.cs.meta


fileFormatVersion: 2
guid: a55ecbf349308fc42be9872f9894bafa
guid: 087f04a0f817c45f4a709ed36fe5ba1a
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Tests/Editor/GridSensors/GridSensorTests.cs.meta


fileFormatVersion: 2
guid: 056b95810b761d543a0dbbf7e7709e20
guid: 2a8626afd640a4edd942dac3d8d6bc85
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Runtime/Sensors/CountingGridSensor.cs.meta


fileFormatVersion: 2
guid: 630b065522bc281409501355842d8af4
guid: a99e8702817b641c2a3ccb6520403e9b
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Runtime/Sensors/GridSensorBase.cs.meta


fileFormatVersion: 2
guid: e27c92ddd6b03714bbfcde95c7c2a376
guid: 2454efb6b02aa414dae2cb8573e87682
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Runtime/Sensors/OneHotGridSensor.cs.meta


fileFormatVersion: 2
guid: e1ae8cd2fe32b0f4ca9b2dfd370fa1b7
guid: 914f5ab90be9e411d83642035abebc2c
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Tests/Editor/GridSensors/SimpleTestGridSensor.cs.meta


fileFormatVersion: 2
guid: 06b1a7a5dba5ce345ad8dc4d97deef62
guid: 72f121528c63749688e53aa926f2cb0a
MonoImporter:
externalObjects: {}
serializedVersion: 2

254
com.unity.ml-agents.extensions/Runtime/Sensors/BoxOverlapChecker.cs


using System;
using System.Runtime.CompilerServices;
using UnityEngine;
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.EditorTests")]
namespace Unity.MLAgents.Extensions.Sensors
{
internal class BoxOverlapChecker
{
Vector3 m_CellScale;
Vector3Int m_GridSize;
bool m_RotateWithAgent;
LayerMask m_ColliderMask;
GameObject m_RootReference;
string[] m_DetectableTags;
int m_InitialColliderBufferSize;
int m_MaxColliderBufferSize;
int m_NumCells;
Vector3 m_HalfCellScale;
Vector3 m_CellCenterOffset;
Vector3[] m_CellLocalPositions;
Collider[] m_ColliderBuffer;
public event Action<GameObject, int> GridOverlapDetectedAll;
public event Action<GameObject, int> GridOverlapDetectedClosest;
public event Action<GameObject, int> GridOverlapDetectedDebug;
public BoxOverlapChecker(
Vector3 cellScale,
Vector3Int gridSize,
bool rotateWithAgent,
LayerMask colliderMask,
GameObject rootReference,
string[] detectableTags,
int initialColliderBufferSize,
int maxColliderBufferSize)
{
m_CellScale = cellScale;
m_GridSize = gridSize;
m_RotateWithAgent = rotateWithAgent;
m_ColliderMask = colliderMask;
m_RootReference = rootReference;
m_DetectableTags = detectableTags;
m_InitialColliderBufferSize = initialColliderBufferSize;
m_MaxColliderBufferSize = maxColliderBufferSize;
m_NumCells = gridSize.x * gridSize.z;
m_HalfCellScale = new Vector3(cellScale.x / 2f, cellScale.y, cellScale.z / 2f);
m_CellCenterOffset = new Vector3((gridSize.x - 1f) / 2, 0, (gridSize.z - 1f) / 2);
m_ColliderBuffer = new Collider[Math.Min(m_MaxColliderBufferSize, m_InitialColliderBufferSize)];
InitCellLocalPositions();
}
public bool RotateWithAgent
{
get { return m_RotateWithAgent; }
set { m_RotateWithAgent = value; }
}
public LayerMask ColliderMask
{
get { return m_ColliderMask; }
set { m_ColliderMask