浏览代码

added new movement controller. refactored walljumpagent

/hh-develop-walljump_bugfixes
Hunter 5 年前
当前提交
079bf01a
共有 13 个文件被更改,包括 443 次插入316 次删除
  1. 3
      UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/AgentCubeGroundCheck.cs
  2. 3
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Brains/BigWallJumpLearning.asset
  3. 3
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Brains/SmallWallJumpLearning.asset
  4. 5
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Brains/WallJumpPlayer.asset
  5. 230
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Prefabs/WallJumpArea.prefab
  6. 295
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Scenes/WallJump.unity
  7. 19
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAcademy.cs
  8. 112
      UnitySDK/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs
  9. 9
      UnitySDK/ProjectSettings/EditorSettings.asset
  10. 2
      UnitySDK/csharp_timers.json
  11. 2
      csharp_timers.json
  12. 73
      UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/AgentCubeMovement.cs
  13. 3
      UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/AgentCubeMovement.cs.meta

3
UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/AgentCubeGroundCheck.cs


public Vector3 groundCheckBoxSize = new Vector3(0.99f, 0.02f, 0.99f);
public bool isGrounded;
public float ungroundedTime; //amount of time agent hasn't been grounded
public float groundedTime; //amount of time agent has been grounded
void FixedUpdate()

{
ungroundedTime += Time.deltaTime;
groundedTime = 0;
groundedTime += Time.deltaTime;
ungroundedTime = 0;
}
}

3
UnitySDK/Assets/ML-Agents/Examples/WallJump/Brains/BigWallJumpLearning.asset


brainParameters:
vectorObservationSize: 83
numStackedVectorObservations: 1
vectorActionSize: 03000000030000000300000002000000
vectorActionSize: 030000000300000002000000
-
-
-
-

3
UnitySDK/Assets/ML-Agents/Examples/WallJump/Brains/SmallWallJumpLearning.asset


brainParameters:
vectorObservationSize: 83
numStackedVectorObservations: 1
vectorActionSize: 03000000030000000300000002000000
vectorActionSize: 030000000300000002000000
-
-
-
-

5
UnitySDK/Assets/ML-Agents/Examples/WallJump/Brains/WallJumpPlayer.asset


brainParameters:
vectorObservationSize: 83
numStackedVectorObservations: 1
vectorActionSize: 03000000030000000300000002000000
vectorActionSize: 030000000300000002000000
-
-
-
-

branchIndex: 1
value: 1
- key: 32
branchIndex: 3
branchIndex: 2
value: 1

230
UnitySDK/Assets/ML-Agents/Examples/WallJump/Prefabs/WallJumpArea.prefab


m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!1 &1040054285917182
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4982066033175770}
- component: {fileID: 33270795607675966}
- component: {fileID: 135059703222534478}
- component: {fileID: 23641080074277960}
- component: {fileID: 54949149748672182}
m_Layer: 0
m_Name: Sphere
m_TagString: block
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!1 &1191598557174792
GameObject:
m_ObjectHideFlags: 1

m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1485171514847798
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4581736733780204}
- component: {fileID: 33929573470517752}
- component: {fileID: 65633408188627868}
- component: {fileID: 23691439635972052}
- component: {fileID: 54056988429233430}
m_Layer: 0
m_Name: ShortBlock (1)
m_TagString: block
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!1 &1522580096460278
GameObject:
m_ObjectHideFlags: 1

m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
m_Children: []
m_Father: {fileID: 4768003208014390}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4581736733780204
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1485171514847798}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.89, y: 1.33, z: -7.86}
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
m_Children: []
m_Father: {fileID: 4768003208014390}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4651390251185036
Transform:

- {fileID: 4011541840118462}
- {fileID: 4764219638476960}
- {fileID: 4886712515982252}
- {fileID: 4982066033175770}
- {fileID: 4581736733780204}
- {fileID: 4969149838347924}
- {fileID: 4969149838347924}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_GameObject: {fileID: 1528738716925344}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -1.98}
m_LocalScale: {x: 21.5, y: 0, z: 1.5}
m_LocalScale: {x: 21.5, y: 8.5, z: 1.5}
m_Children: []
m_Father: {fileID: 4768003208014390}
m_RootOrder: 0

m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
m_Children: []
m_Father: {fileID: 4768003208014390}
m_RootOrder: 7
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4969149838347924
Transform:

m_LocalScale: {x: 3, y: 1.5, z: 3}
m_Children: []
m_Father: {fileID: 4768003208014390}
m_RootOrder: 6
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4982066033175770
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1040054285917182}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 3.01, y: 1.3299999, z: -7.8600006}
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
m_Children: []
m_Father: {fileID: 4768003208014390}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &20236434339313884
Camera:

m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!23 &23641080074277960
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1040054285917182}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!23 &23691439635972052
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1485171514847798}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: eaad04b0e0dec42229c9cb00a981d7ac, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!23 &23724199705901440
MeshRenderer:
m_ObjectHideFlags: 1

m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1324926338613664}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &33270795607675966
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1040054285917182}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &33378601950005852
MeshFilter:
m_ObjectHideFlags: 1

m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1522580096460278}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &33929573470517752
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1485171514847798}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &33966533147322750
MeshFilter:
m_ObjectHideFlags: 1

m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!54 &54056988429233430
Rigidbody:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1485171514847798}
serializedVersion: 2
m_Mass: 20
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 80
m_CollisionDetection: 0
--- !u!54 &54408752902065764
Rigidbody:
m_ObjectHideFlags: 1

m_GameObject: {fileID: 1195095783991828}
serializedVersion: 2
m_Mass: 10
m_Drag: 0.5
m_AngularDrag: 0.05
m_Drag: 1
m_AngularDrag: 1
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0

m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1478101936519122}
serializedVersion: 2
m_Mass: 20
m_Drag: 0
m_AngularDrag: 0.05
m_Mass: 25
m_Drag: 0.5
m_AngularDrag: 0.5
m_Constraints: 80
m_Constraints: 0
m_CollisionDetection: 0
--- !u!54 &54796686971211664
Rigidbody:

m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!54 &54949149748672182
Rigidbody:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1040054285917182}
serializedVersion: 2
m_Mass: 150
m_Drag: 0.5
m_AngularDrag: 0.5
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 1
--- !u!54 &54965883911478546
Rigidbody:
m_ObjectHideFlags: 1

serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!65 &65633408188627868
BoxCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1485171514847798}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!65 &65735913549688546
BoxCollider:
m_ObjectHideFlags: 1

groundCheckBoxSize: {x: 0.99, y: 0.02, z: 0.99}
isGrounded: 0
ungroundedTime: 0
groundedTime: 0
--- !u!114 &114925928594762506
MonoBehaviour:
m_ObjectHideFlags: 1

bigWallBrain: {fileID: 11400000, guid: b5f530c5bf8d64bf8a18df92e283bb9c, type: 2}
ground: {fileID: 1324926338613664}
spawnArea: {fileID: 1886170194660384}
shortBlock: {fileID: 1384622690378190}
shortBlock: {fileID: 1478101936519122}
jumpTimer: 0
m_agentMovement: {fileID: 0}
smoothTime: 0.15
--- !u!135 &135059703222534478
SphereCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1040054285917182}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!135 &135413715923451314
SphereCollider:
m_ObjectHideFlags: 1

295
UnitySDK/Assets/ML-Agents/Examples/WallJump/Scenes/WallJump.unity


debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &92261730
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 1019344445637276, guid: 54e3af627216447f790531de496099f0,
type: 2}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 92261731}
- component: {fileID: 92261735}
- component: {fileID: 92261734}
- component: {fileID: 92261733}
- component: {fileID: 92261732}
m_Layer: 0
m_Name: ShortBlock (1)
m_TagString: block
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &92261731
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 4969149838347924, guid: 54e3af627216447f790531de496099f0,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 92261730}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.89, y: 1.33, z: -7.86}
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
m_Children: []
m_Father: {fileID: 137339789}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &92261732
Rigidbody:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 54408752902065764, guid: 54e3af627216447f790531de496099f0,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 92261730}
serializedVersion: 2
m_Mass: 20
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 80
m_CollisionDetection: 0
--- !u!23 &92261733
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 23244285057608692, guid: 54e3af627216447f790531de496099f0,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 92261730}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: eaad04b0e0dec42229c9cb00a981d7ac, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!65 &92261734
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 65735913549688546, guid: 54e3af627216447f790531de496099f0,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 92261730}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!33 &92261735
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 33731768374180322, guid: 54e3af627216447f790531de496099f0,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 92261730}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1001 &117944611
Prefab:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
--- !u!4 &137339789 stripped
Transform:
m_PrefabParentObject: {fileID: 4768003208014390, guid: 54e3af627216447f790531de496099f0,
type: 2}
m_PrefabInternal: {fileID: 1838274516}
--- !u!1001 &201057664
Prefab:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
--- !u!1 &252453051
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 252453055}
- component: {fileID: 252453054}
- component: {fileID: 252453053}
- component: {fileID: 252453052}
- component: {fileID: 252453056}
m_Layer: 0
m_Name: Sphere
m_TagString: block
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!23 &252453052
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 252453051}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!135 &252453053
SphereCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 252453051}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!33 &252453054
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 252453051}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &252453055
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 252453051}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 3.01, y: 1.3299999, z: -7.8600006}
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
m_Children: []
m_Father: {fileID: 137339789}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &252453056
Rigidbody:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 252453051}
serializedVersion: 2
m_Mass: 150
m_Drag: 0.5
m_AngularDrag: 0.5
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 1
--- !u!1 &318490716
GameObject:
m_ObjectHideFlags: 1

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1886170194660384, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

m_Component:
- component: {fileID: 1574236049}
- component: {fileID: 1574236050}
- component: {fileID: 1574236048}
m_Layer: 0
m_Name: Academy
m_TagString: Untagged

m_IsActive: 1
--- !u!114 &1574236048
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1574236047}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7dbad9f11d9f4b2884e5f8fd66c81426, type: 3}
m_Name:
m_EditorClassIdentifier:
runningForceMode: 1
agentRunSpeed: 20
agentRunInAirSpeed: 10
agentIdleDragVelCoeff: 0.9
agentRotationSpeed: 7
agentJumpVelocity: 20
agentFallingSpeed: 50
--- !u!4 &1574236049
Transform:
m_ObjectHideFlags: 0

value: 0
- key: big_wall_max_height
value: 8.5
agentRunSpeed: 5
agentMaxVel: 10
agentJumpHeight: 2.75
agentRotationSpeed: 7
agentFallingSpeed: 100
agentJumpVelocity: 25
agentJumpVelocityMaxChange: 10
--- !u!1001 &1838274516
Prefab:
m_ObjectHideFlags: 0

propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 4969149838347924, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
propertyPath: shortBlock
propertyPath: m_agentMovement
objectReference: {fileID: 252453051}
- target: {fileID: 1019344445637276, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
objectReference: {fileID: 1574236048}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}
m_IsPrefabParent: 0

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

objectReference: {fileID: 0}
- target: {fileID: 1280098394364104, guid: 54e3af627216447f790531de496099f0, type: 2}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 54e3af627216447f790531de496099f0, type: 2}

19
UnitySDK/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAcademy.cs


public class WallJumpAcademy : Academy
{
[Header("Specific to WallJump")]
public float agentRunSpeed;
public float agentMaxVel = 5; //maximum agent velocity
public float agentJumpHeight;
public float agentRotationSpeed = 5;
public float agentFallingSpeed = 100;
// public float agentRunSpeed;
// public float agentMaxVel = 5; //maximum agent velocity
// public float agentIdleDragVelCoeff = .95f; //coeff used to dampen idle velocity
// public float agentJumpHeight;
// public float agentRotationSpeed = 5;
// public float agentFallingSpeed = 100;
//when a goal is scored the ground will use this material for a few seconds.
public Material goalScoredMaterial;
//when fail, the ground will use this material for a few seconds.

//use ~3 to make things less floaty
public float gravityMultiplier = 2.5f;
// [HideInInspector]
public float agentJumpVelocity = 3;
// public float agentJumpVelocity = 777;
[HideInInspector]
public float agentJumpVelocityMaxChange = 10;
// public float agentJumpVelocity = 3;
// // public float agentJumpVelocity = 777;
// [HideInInspector]
// public float agentJumpVelocityMaxChange = 10;
// Use this for initialization
public override void InitializeAcademy()

112
UnitySDK/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs


RayPerception m_RayPer;
// public float jumpingTime;
// public float jumpTime;
public float jumpTimer; //timer used to control jump timing & prevent rapid doublejumps
// // This is a downward force applied when falling to make jumps look
// // less floaty
// public float fallingForce;

public float m_currentVelMag;
//Groundcheck
AgentCubeGroundCheck m_groundCheck;
private AgentCubeGroundCheck m_groundCheck;
public AgentCubeMovement m_agentMovement;
public float smoothTime = 0.3F;
private Vector3 velocity = Vector3.zero;
m_agentMovement = FindObjectOfType<AgentCubeMovement>();
m_RayPer = GetComponent<RayPerception>();
m_Configuration = Random.Range(0, 5);
m_DetectableObjects = new[] { "wall", "goal", "block" };

AddVectorObs(agentPos / 20f);
// AddVectorObs(grounded? 1 : 0);
AddVectorObs(m_groundCheck.isGrounded);
AddVectorObs(m_AgentRb.velocity/m_Academy.agentMaxVel);
AddVectorObs(m_AgentRb.velocity/m_agentMovement.agentRunSpeed);
AddVectorObs(m_AgentRb.angularVelocity/m_AgentRb.maxAngularVelocity);
AddVectorObs(m_AgentRb.transform.forward);
}

var rotateDir = Vector3.zero;
var dirToGoForwardAction = (int)act[0];
var rotateDirAction = (int)act[1];
var dirToGoSideAction = (int)act[2];
var jumpAction = (int)act[3];
// var dirToGoSideAction = (int)act[2];
var jumpAction = (int)act[2];
// print($"Academy: {m_Academy.GetStepCount()}");
// print($"Agent: {GetStepCount()}");
// print($"Action: {GetStepCount()} {fuTimer}");

dirToGo += transform.forward;
else if (dirToGoForwardAction == 2)
dirToGo += -transform.forward;
if (dirToGoSideAction == 1)
dirToGo += -transform.right;
else if (dirToGoSideAction == 2)
dirToGo += transform.right;
// if (dirToGoSideAction == 1)
// dirToGo += -transform.right;
// else if (dirToGoSideAction == 2)
// dirToGo += transform.right;
rotateDir = transform.up * -1f;
rotateDir = -transform.up ;
rotateDir = transform.up * 1f;
rotateDir = transform.up;
// if (m_groundCheck.isGrounded && jumpTimer > .15f)
Vector3 velToUse = m_AgentRb.velocity;
velToUse.y = m_Academy.agentJumpVelocity;
m_AgentRb.velocity = velToUse;
// m_AgentRb.AddForce(Vector3.up * m_Academy.agentJumpVelocity,
// ForceMode.VelocityChange);
// jumpTimer = 0f;
m_agentMovement.Jump(m_AgentRb);
// Vector3 velToUse = m_AgentRb.velocity;
// velToUse.y = m_Academy.agentJumpVelocity;
// m_AgentRb.velocity = velToUse;
// m_AgentRb.AddForce(Vector3.up * m_Academy.agentJumpVelocity,
// ForceMode.VelocityChange);
// m_AgentRb.AddForce(Vector3.up * m_Academy.agentJumpVelocity,
// ForceMode.Impulse);
transform.Rotate(rotateDir, m_Academy.agentRotationSpeed);
// transform.Rotate(rotateDir, m_Academy.agentRotationSpeed);
if (rotateDir != Vector3.zero)
{
m_agentMovement.RotateBody(m_AgentRb, rotateDir);
// m_AgentRb.MoveRotation(m_AgentRb.rotation * Quaternion.AngleAxis(m_Academy.agentRotationSpeed, rotateDir));
}
float runSpeed = m_groundCheck.isGrounded? m_Academy.agentRunSpeed: m_Academy.agentRunSpeed * .25f;
if(m_currentVelMag < m_Academy.agentMaxVel)
//Running Logic
// float runSpeed = Mathf.Clamp(m_agentMovement.agentRunSpeed - m_currentVelMag, 0, m_agentMovement.agentRunSpeed);
// float runSpeed = Mathf.Clamp(m_agentMovement.agentRunMaxVelMagnitude - m_currentVelMag, 0, m_agentMovement.agentRunMaxVelMagnitude);
if (!m_groundCheck.isGrounded)
// if (m_groundCheck.isGrounded)
// {
m_AgentRb.AddForce(dirToGo.normalized * runSpeed,
ForceMode.VelocityChange);
// }
m_agentMovement.RunInAir(m_AgentRb, dirToGo.normalized);
else
{
m_agentMovement.RunOnGround(m_AgentRb, dirToGo.normalized);
}
// m_AgentRb.AddForce(dirToGo.normalized * runSpeed,
// ForceMode.VelocityChange);
// m_AgentRb.AddForce(dirToGo.normalized * runSpeed,
// ForceMode.Impulse);
// if (m_groundCheck.isGrounded && dirToGo == Vector3.zero && jumpTimer > .15f)
if (m_groundCheck.isGrounded && dirToGo == Vector3.zero)
{
m_agentMovement.AddIdleDrag(m_AgentRb);
// m_AgentRb.velocity *= m_Academy.agentIdleDragVelCoeff;
// print("damping");
}
// //Running Logic
// Vector3 smoothedVel = Vector3.SmoothDamp(m_AgentRb.velocity, dirToGo * runSpeed, ref velocity, smoothTime);
// m_AgentRb.velocity = smoothedVel;
// if(m_currentVelMag < m_Academy.agentMaxVel)
// {
// m_AgentRb.AddForce(dirToGo * m_Academy.agentRunSpeed,

// m_Academy.agentJumpVelocityMaxChange);
// }
// if (!m_groundCheck.isGrounded && jumpTimer > .15f)
m_AgentRb.AddForce(
// Vector3.down * fallingForce, ForceMode.Acceleration);
Vector3.down * m_Academy.agentFallingSpeed, ForceMode.Acceleration);
m_agentMovement.AddFallingForce(m_AgentRb);
// m_AgentRb.AddForce(
// // Vector3.down * fallingForce, ForceMode.Acceleration);
// Vector3.down * m_Academy.agentFallingSpeed, ForceMode.Acceleration);
}
// if (!(jumpingTime > 0f) && !m_groundCheck.isGrounded)
// {

// }
// jumpingTime -= Time.fixedDeltaTime;
// jumpTimer += Time.fixedDeltaTime;
}
// public void MoveAgent(float[] act)
// {

private void FixedUpdate()
{
m_currentVelMag = m_AgentRb.velocity.magnitude;
fuTimer++;
// if (m_Configuration != -1)
// {
// ConfigureAgent(m_Configuration);
// m_Configuration = -1;
// }
// fuTimer++;
if (m_Configuration != -1)
{
ConfigureAgent(m_Configuration);
m_Configuration = -1;
}
}
/// <summary>

9
UnitySDK/ProjectSettings/EditorSettings.asset


--- !u!159 &1
EditorSettings:
m_ObjectHideFlags: 0
serializedVersion: 4
serializedVersion: 7
m_LineEndingsForNewScripts: 1
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd
m_EtcTextureCompressorBehavior: 0
m_EtcTextureFastCompressor: 2
m_EtcTextureNormalCompressor: 2
m_EtcTextureBestCompressor: 5
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef
m_ProjectGenerationRootNamespace:
m_UserGeneratedProjectSuffix:
m_CollabEditorSettings:

2
UnitySDK/csharp_timers.json


{"count":1,"self":75.7271104,"total":89.109481,"children":{"AgentResetIfDone":{"count":4360,"self":0.21384199999999998,"total":0.21384199999999998,"children":null},"AgentSendState":{"count":4360,"self":1.359667,"total":3.765707,"children":{"CollectObservations":{"count":34896,"self":2.40604,"total":2.40604,"children":null}}},"BrainDecideAction":{"count":4360,"self":6.1270219999999993,"total":6.1270219999999993,"children":null},"AcademyStep":{"count":4360,"self":0.119783,"total":0.119783,"children":null},"AgentAct":{"count":4360,"self":3.155154,"total":3.155154,"children":null}}}
{"count":1,"self":59.143136,"total":59.827309,"children":{"AgentResetIfDone":{"count":2884,"self":0.143195,"total":0.143195,"children":null},"AgentSendState":{"count":2884,"self":0.131877,"total":0.223355,"children":{"CollectObservations":{"count":962,"self":0.09147799999999999,"total":0.09147799999999999,"children":null}}},"BrainDecideAction":{"count":2884,"self":0.097074,"total":0.097074,"children":null},"AcademyStep":{"count":2884,"self":0.087388,"total":0.087388,"children":null},"AgentAct":{"count":2884,"self":0.13186399999999998,"total":0.13186399999999998,"children":null}}}

2
csharp_timers.json


{"count":1,"self":734.6514432,"total":19807.115766,"children":{"AgentResetIfDone":{"count":986659,"self":10.4867776,"total":10.486778,"children":null},"AgentSendState":{"count":986659,"self":64.5328,"total":294.04925099999997,"children":{"CollectObservations":{"count":7893288,"self":229.51644159999998,"total":229.51645399999998,"children":null}}},"BrainDecideAction":{"count":986659,"self":18022.7817472,"total":18022.782152,"children":null},"AcademyStep":{"count":986659,"self":6.2750179999999993,"total":6.2750179999999993,"children":null},"AgentAct":{"count":986659,"self":738.8690944,"total":738.86911,"children":null}}}
{"count":1,"self":325.8655232,"total":11325.855853,"children":{"AgentResetIfDone":{"count":461409,"self":4.413044,"total":4.413044,"children":null},"AgentSendState":{"count":461409,"self":29.0895232,"total":133.040449,"children":{"CollectObservations":{"count":3691272,"self":103.9509248,"total":103.950925,"children":null}}},"BrainDecideAction":{"count":461409,"self":10831.9637504,"total":10831.963456,"children":null},"AcademyStep":{"count":461409,"self":2.617991,"total":2.617991,"children":null},"AgentAct":{"count":461409,"self":27.953027199999998,"total":27.953025999999998,"children":null}}}ldren":null}}}

73
UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/AgentCubeMovement.cs


using UnityEngine;
namespace MLAgents
{
public class AgentCubeMovement : MonoBehaviour
{
[Header("RUNNING")] public ForceMode runningForceMode = ForceMode.Impulse;
//speed agent can run if grounded
public float agentRunSpeed = 20;
//speed agent can run if not grounded
public float agentRunInAirSpeed = 10f;
[Header("IDLE")]
//coefficient used to dampen velocity when idle
//the purpose of this is to fine tune agent drag
//...and prevent the agent sliding around while grounded
//0 means it will instantly stop when grounded
//1 means no drag will be applied
public float agentIdleDragVelCoeff = .85f;
[Header("BODY ROTATION")]
//body rotation speed
public float agentRotationSpeed = 7f;
[Header("JUMPING")]
//upward jump velocity magnitude
public float agentJumpVelocity = 15f;
[Header("FALLING FORCE")]
//force applied to agent while falling
public float agentFallingSpeed = 50f;
public void Jump(Rigidbody rb)
{
Vector3 velToUse = rb.velocity;
velToUse.y = agentJumpVelocity;
rb.velocity = velToUse;
}
public void RotateBody(Rigidbody rb, Vector3 rotationAxis)
{
rb.MoveRotation(rb.rotation * Quaternion.AngleAxis(agentRotationSpeed, rotationAxis));
}
public void RunOnGround(Rigidbody rb, Vector3 dir)
{
var vel = rb.velocity.magnitude;
float adjustedSpeed = Mathf.Clamp(agentRunSpeed - vel, 0, agentRunSpeed);
rb.AddForce(dir.normalized * adjustedSpeed,
runningForceMode);
}
public void RunInAir(Rigidbody rb, Vector3 dir)
{
var vel = rb.velocity.magnitude;
float adjustedSpeed = Mathf.Clamp(agentRunInAirSpeed - vel, 0, agentRunInAirSpeed);
rb.AddForce(dir.normalized * adjustedSpeed,
runningForceMode);
}
public void AddIdleDrag(Rigidbody rb)
{
rb.velocity *= agentIdleDragVelCoeff;
}
public void AddFallingForce(Rigidbody rb)
{
rb.AddForce(
Vector3.down * agentFallingSpeed, ForceMode.Acceleration);
}
}
}

3
UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/AgentCubeMovement.cs.meta


fileFormatVersion: 2
guid: 7dbad9f11d9f4b2884e5f8fd66c81426
timeCreated: 1571951124
正在加载...
取消
保存