浏览代码

static grid working

/develop/pushcollabonly
HH 3 年前
当前提交
dbe91e81
共有 8 个文件被更改,包括 1287 次插入306 次删除
  1. 409
      Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlockCollab.unity
  2. 2
      com.unity.ml-agents.extensions/Runtime/Sensors/CountingGridSensor.cs
  3. 158
      com.unity.ml-agents.extensions/Runtime/Sensors/GridSensor.cs
  4. 8
      Project/Assets/ML-Agents/Examples/Arena-Sequence.meta
  5. 1001
      Project/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockCollabAreaStaticGrid.prefab
  6. 7
      Project/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockCollabAreaStaticGrid.prefab.meta
  7. 8
      Project/Assets/ML-Agents/Examples/Arena-Sequence/TFModels.meta

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


objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5889392e3f05b448a8a06c5def6c2dec, type: 3}
--- !u!1001 &687199677
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2313762877161590336, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: GroupId
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalPosition.x
value: 50
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2416678558414254088, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_Name
value: PushBlockCollabArea (1)
objectReference: {fileID: 0}
- target: {fileID: 2416809913911815199, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: GroupId
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8689a8cfb0ac742bfa27214909ebb1e8, type: 3}
--- !u!1001 &768746187
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2313762877161590336, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: GroupId
value: 3
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalPosition.x
value: 150
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_RootOrder
value: 9
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2416678558414254088, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: m_Name
value: PushBlockCollabArea (3)
objectReference: {fileID: 0}
- target: {fileID: 2416809913911815199, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: GroupId
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8689a8cfb0ac742bfa27214909ebb1e8, type: 3}
--- !u!1 &1009000883
GameObject:
m_ObjectHideFlags: 0

m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!1001 &1219049691
--- !u!1 &1257687048
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1257687049}
m_Layer: 0
m_Name: 50bfc0f4c3d6f46df98d3c66ceb89209
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1257687049
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1257687048}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 365376271}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1264586496
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2

- target: {fileID: 2313762877161590336, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: GroupId
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
value: 200
value: 0
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
value: 0
value: -23.7
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
value: 10
value: 9
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2416678558414254088, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8191903532335653025, guid: f5bbed44a6ea747a687fbbb738eb1730,
value: PushBlockCollabArea (4)
objectReference: {fileID: 0}
- target: {fileID: 2416809913911815199, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: GroupId
value: 4
value: PushBlockCollabAreaStaticGrid (3)
m_SourcePrefab: {fileID: 100100000, guid: 8689a8cfb0ac742bfa27214909ebb1e8, type: 3}
--- !u!1 &1257687048
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1257687049}
m_Layer: 0
m_Name: 50bfc0f4c3d6f46df98d3c66ceb89209
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1257687049
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1257687048}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 365376271}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_SourcePrefab: {fileID: 100100000, guid: f5bbed44a6ea747a687fbbb738eb1730, type: 3}
--- !u!1 &1265651285
GameObject:
m_ObjectHideFlags: 0

m_Father: {fileID: 318490717}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1558468742
--- !u!1001 &1360124071
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2

- target: {fileID: 2313762877161590336, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: GroupId
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
value: 100
value: 0
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
value: 0
value: -7.7
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
value: 8
value: 7
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2416678558414254088, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8191903532335653025, guid: f5bbed44a6ea747a687fbbb738eb1730,
value: PushBlockCollabArea (2)
objectReference: {fileID: 0}
- target: {fileID: 2416809913911815199, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
type: 3}
propertyPath: GroupId
value: 2
value: PushBlockCollabAreaStaticGrid (1)
m_SourcePrefab: {fileID: 100100000, guid: 8689a8cfb0ac742bfa27214909ebb1e8, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: f5bbed44a6ea747a687fbbb738eb1730, type: 3}
--- !u!1 &1574236047
GameObject:
m_ObjectHideFlags: 0

spawnAreaMarginMultiplier: 0.5
goalScoredMaterial: {fileID: 2100000, guid: df32cc593804f42df97464dc455057b8, type: 2}
failMaterial: {fileID: 2100000, guid: a1daf31cdf41e484ca9ac33a5c6f524a, type: 2}
--- !u!1001 &1849796285
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalPosition.y
value: -16
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
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: 8
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.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8191903532335653025, guid: f5bbed44a6ea747a687fbbb738eb1730,
type: 3}
propertyPath: m_Name
value: PushBlockCollabAreaStaticGrid (2)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f5bbed44a6ea747a687fbbb738eb1730, type: 3}
--- !u!1001 &1900462655
PrefabInstance:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3ce107b4a79bc4eef83afde434932a68, type: 3}
--- !u!1001 &2416809913901764614
--- !u!1001 &8191066183554171055
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2

- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2415063656827223864, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8188317207052398481, guid: f5bbed44a6ea747a687fbbb738eb1730,
- target: {fileID: 2416678558414254088, guid: 8689a8cfb0ac742bfa27214909ebb1e8,
- target: {fileID: 8191903532335653025, guid: f5bbed44a6ea747a687fbbb738eb1730,
value: PushBlockCollabArea
value: PushBlockCollabAreaStaticGrid
m_SourcePrefab: {fileID: 100100000, guid: 8689a8cfb0ac742bfa27214909ebb1e8, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: f5bbed44a6ea747a687fbbb738eb1730, type: 3}

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


this.CellScaleZ = cellScaleZ;
this.GridNumSideX = gridWidth;
this.GridNumSideZ = gridHeight;
this.RotateToAgent = rotateToAgent;
this.RotateGridWithRoot = rotateToAgent;
this.DiffNumSideZX = (GridNumSideZ - GridNumSideX);
this.OffsetGridNumSide = (GridNumSideZ - 1f) / 2f;
this.DebugColors = debugColors;

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


public float CellScaleX = 1f;
/// <summary>
/// The height of each grid cell. Changes how much of the vertical axis is observed by a cell.
/// </summary>
[Tooltip("The height of each grid cell. Changes how much of the vertical axis is observed by a cell")]
[Range(0.01f, 1000f)]
public float CellScaleY = 0.01f;
/// <summary>
/// The depth of each grid cell.
/// </summary>
[Tooltip("The depth of each grid cell")]

[Range(2, 2000)]
public int GridNumSideZ = 16;
/// <summary>
/// The height of each grid cell. Changes how much of the vertical axis is observed by a cell.
/// </summary>
[Tooltip("The height of each grid cell. Changes how much of the vertical axis is observed by a cell")]
[Range(0.01f, 1000f)]
public float CellScaleY = 0.01f;
public bool RotateToAgent;
public bool RotateGridWithRoot;
/// <summary>
/// Array holding the depth of each channel.

/// </summary>
private List<byte[]> byteSizesBytesList;
private Color DebugDefaultColor = new Color(1f, 1f, 1f, 0.25f);
private Color DebugDefaultColor = new Color(1f, 1f, 1f, 0.05f);
// public GridSensor GridSensorToObserve;
// return GridSensorToObserve;
return this;
}

this.CellScaleZ = cellScaleZ;
this.GridNumSideX = gridWidth;
this.GridNumSideZ = gridHeight;
this.RotateToAgent = rotateToAgent;
this.RotateGridWithRoot = rotateToAgent;
this.DiffNumSideZX = (GridNumSideZ - GridNumSideX);
this.OffsetGridNumSide = (GridNumSideZ - 1f) / 2f;
this.DebugColors = debugColors;

ClearPerceptionBuffer();
using (TimerStack.Instance.Scoped("GridSensor.Perceive"))
{
var halfCellScale = new Vector3(CellScaleX / 2f, CellScaleY, CellScaleZ / 2f);
// var halfCellScale = new Vector3(CellScaleX / 2f, CellScaleY, CellScaleZ / 2f);
var halfCellScale = new Vector3(CellScaleX / 2f, CellScaleY / 2, CellScaleZ / 2f);
// Vector3 halfCellScale = Vector3.one * (overlapBoxScale * .5f);
if (RotateToAgent)
if (RotateGridWithRoot)
Transform transform1;
cellCenter = (transform1 = transform).TransformPoint(CellPoints[cellIndex]);
numFound = BufferResizingOverlapBoxNonAlloc(cellCenter, halfCellScale, transform1.rotation);
// Transform transform1;
// cellCenter = (transform1 = transform).TransformPoint(CellPoints[cellIndex]);
// numFound = BufferResizingOverlapBoxNonAlloc(cellCenter, halfCellScale, transform1.rotation);
cellCenter = rootReference.transform.TransformPoint(CellPoints[cellIndex]);
numFound = BufferResizingOverlapBoxNonAlloc(cellCenter, halfCellScale, rootReference.transform.rotation);
numFound = BufferResizingOverlapBoxNonAlloc(cellCenter, halfCellScale, Quaternion.identity);
// numFound = BufferResizingOverlapBoxNonAlloc(cellCenter, halfCellScale, Quaternion.identity);
numFound = BufferResizingOverlapBoxNonAlloc(cellCenter, halfCellScale, rootReference.transform.rotation);
}
if (numFound > 0)

{
var currentColliderGo = foundColliders[i].gameObject;
// Continue if the current collider go is the root reference
if (ReferenceEquals(currentColliderGo, rootReference))
// // Continue if the current collider go is the root reference
// if (ReferenceEquals(currentColliderGo, rootReference))
// continue;
if (collidersToIgnore.Contains(foundColliders[i]))
// if (currentColliderGo == rootReference && !MapThisAgent)
// if (!MapThisAgent)
continue;
var closestColliderPoint = foundColliders[i].ClosestPointOnBounds(cellCenter);

float z = (cell / GridNumSideZ - OffsetGridNumSide) * CellScaleZ - DiffNumSideZX;
if (shouldTransformPoint)
return transform.TransformPoint(new Vector3(x, 0, z));
return rootReference.transform.TransformPoint(new Vector3(x, 0, z));
// return transform.TransformPoint(new Vector3(x, 0, z));
/// <summary>Finds the cell in which the given global point falls</summary>
/// <returns>
/// The index of the cell in which the global point falls or -1 if the point does not fall into a cell
/// </returns>
/// <param name="globalPoint">The 3D point in global space</param>
public int PointToCell(Vector3 globalPoint)
{
Vector3 point = transform.InverseTransformPoint(globalPoint);
if (point.x < -HalfOfGridX || point.x > HalfOfGridX || point.z < -HalfOfGridZ || point.z > HalfOfGridZ)
return -1;
float x = point.x + HalfOfGridX;
float z = point.z + HalfOfGridZ;
int _x = (int)Mathf.Floor(x * PointToCellScalingX);
int _z = (int)Mathf.Floor(z * PointToCellScalingZ);
return GridNumSideX * _z + _x;
}
// /// <summary>Finds the cell in which the given global point falls</summary>
// /// <returns>
// /// The index of the cell in which the global point falls or -1 if the point does not fall into a cell
// /// </returns>
// /// <param name="globalPoint">The 3D point in global space</param>
// public int PointToCell(Vector3 globalPoint)
// {
// // Vector3 point = transform.InverseTransformPoint(globalPoint);
// Vector3 point = rootReference.transform.InverseTransformPoint(globalPoint);
//
// if (point.x < -HalfOfGridX || point.x > HalfOfGridX || point.z < -HalfOfGridZ || point.z > HalfOfGridZ)
// return -1;
//
// float x = point.x + HalfOfGridX;
// float z = point.z + HalfOfGridZ;
//
// int _x = (int)Mathf.Floor(x * PointToCellScalingX);
// int _z = (int)Mathf.Floor(z * PointToCellScalingZ);
// return GridNumSideX * _z + _x;
// }
/// <summary>Copies the data from one cell to another</summary>
/// <param name="fromCellID">index of the cell to copy from</param>

CellActivity[toCellID] = CellActivity[fromCellID];
}
// void OnDrawGizmos()
// {
// if (ShowGizmos)
// {
// if (Application.isEditor && !Application.isPlaying)
// Start();
//
// Perceive();
//
// var scale = new Vector3(CellScaleX, 1, CellScaleZ);
// var offset = new Vector3(0, GizmoYOffset, 0);
// var oldGizmoMatrix = Gizmos.matrix;
// for (var i = 0; i < NumCells; i++)
// {
// Matrix4x4 cubeTransform;
// if (RotateToAgent)
// {
// cubeTransform = Matrix4x4.TRS(CellToPoint(i) + offset, transform.rotation, scale);
// }
// else
// {
// cubeTransform = Matrix4x4.TRS(CellToPoint(i, false) + transform.position + offset, Quaternion.identity, scale);
// }
// Gizmos.matrix = oldGizmoMatrix * cubeTransform;
// Gizmos.color = CellActivity[i];
// Gizmos.DrawCube(Vector3.zero, Vector3.one);
// }
//
// Gizmos.matrix = oldGizmoMatrix;
//
// if (Application.isEditor && !Application.isPlaying)
// DestroyImmediate(m_perceptionTexture2D);
// }
// }
public List<Collider> collidersToIgnore; //
// public float overlapBoxScale = .5f;
void OnDrawGizmos()
{
if (ShowGizmos)

Perceive();
var scale = new Vector3(CellScaleX, 1, CellScaleZ);
var offset = new Vector3(0, GizmoYOffset, 0);
var oldGizmoMatrix = Gizmos.matrix;
for (var i = 0; i < NumCells; i++)
// Vector3 scale = new Vector3(CellScaleX, 1, CellScaleZ);
Vector3 scale = new Vector3(CellScaleX, CellScaleY, CellScaleZ);
Vector3 offset = new Vector3(0, GizmoYOffset, 0);
Matrix4x4 oldGizmoMatrix = Gizmos.matrix;
Matrix4x4 cubeTransform = Gizmos.matrix;
// Matrix4x4 cubeTransform = rootReference.transform.localToWorldMatrix;
// Matrix4x4 cubeTransform = transform.localToWorldMatrix;
for (int i = 0; i < NumCells; i++)
Matrix4x4 cubeTransform;
if (RotateToAgent)
if (RotateGridWithRoot)
cubeTransform = Matrix4x4.TRS(CellToPoint(i) + offset, transform.rotation, scale);
// cubeTransform = Matrix4x4.TRS(CellToPoint(i) + offset, transform.rotation, scale);
cubeTransform = Matrix4x4.TRS(CellToPoint(i) + offset, rootReference.transform.rotation, scale);
cubeTransform = Matrix4x4.TRS(CellToPoint(i, false) + transform.position + offset, Quaternion.identity, scale);
// cubeTransform = Matrix4x4.TRS(CellToPoint(i, false) + transform.position + offset, Quaternion.identity, scale);
cubeTransform = Matrix4x4.TRS(CellToPoint(i, false) + rootReference.transform.position + offset, Quaternion.identity, scale);
// cubeTransform = Matrix4x4.TRS(CellToPoint(i, false) + offset, Quaternion.identity, scale);
Gizmos.DrawCube(Vector3.zero, Vector3.one);
// Gizmos.DrawCube(Vector3.zero, Vector3.one * .75f);
// Gizmos.DrawCube(Vector3.zero, Vector3.one * overlapBoxScale);
Gizmos.DrawCube(Vector3.zero, scale);
// Gizmos.DrawCube(Vector3.zero, new Vector3(.85f, .15f, .85f));
// Gizmos.DrawWireCube(Vector3.zero, Vector3.one * .75f);
// Gizmos.DrawSphere(Vector3.zero, .5f);
}
Gizmos.matrix = oldGizmoMatrix;

}
}
/// <inheritdoc/>
void ISensor.Update()

8
Project/Assets/ML-Agents/Examples/Arena-Sequence.meta


fileFormatVersion: 2
guid: ab46f01a215b74b588a0a3c180a88813
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockCollabAreaStaticGrid.prefab
文件差异内容过多而无法显示
查看文件

7
Project/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockCollabAreaStaticGrid.prefab.meta


fileFormatVersion: 2
guid: f5bbed44a6ea747a687fbbb738eb1730
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/Arena-Sequence/TFModels.meta


fileFormatVersion: 2
guid: bff21b61cb59d45ef929ade44ddd0a28
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存