From ff3a5cfff2bf6537feee8a6ab38d0d33a9a68135 Mon Sep 17 00:00:00 2001 From: cailean Date: Tue, 19 Mar 2024 13:08:10 +0000 Subject: [PATCH] getup model swap on 'G' added --- Assets/2_Chair/Chair.prefab | 16 ++++++++++- Assets/6_Scenes/Beep.unity | 34 +++++++++++++++--------- Assets/7_Scripts/Agent/Walker.cs | 23 ++++++++++------ Assets/ML-Agents/Timers/Beep_timers.json | 2 +- 4 files changed, 53 insertions(+), 22 deletions(-) diff --git a/Assets/2_Chair/Chair.prefab b/Assets/2_Chair/Chair.prefab index a83a964..db7ba09 100644 --- a/Assets/2_Chair/Chair.prefab +++ b/Assets/2_Chair/Chair.prefab @@ -210,6 +210,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &2225134942834663317 GameObject: m_ObjectHideFlags: 0 @@ -420,6 +421,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &2907507614063161647 GameObject: m_ObjectHideFlags: 0 @@ -630,6 +632,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &3022150810398622485 GameObject: m_ObjectHideFlags: 0 @@ -840,6 +843,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &3028507005537857522 GameObject: m_ObjectHideFlags: 0 @@ -1134,6 +1138,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &3677055482454108232 GameObject: m_ObjectHideFlags: 0 @@ -1385,6 +1390,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &4685213736971843660 GameObject: m_ObjectHideFlags: 0 @@ -1595,6 +1601,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &4871452371939253621 GameObject: m_ObjectHideFlags: 0 @@ -1976,6 +1983,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &5777259271730693716 GameObject: m_ObjectHideFlags: 0 @@ -2067,7 +2075,7 @@ MonoBehaviour: rWalkSpeedEachEpisode: 0 m_RandomiseYRotation: 0 m_RandomiseXYZRotation: 0 - m_ModelSwap: 0 + m_ModelSwap: 1 m_ProximitySwapper: 0 m_SwitchModelAfterFalling: 0 m_StepCountAtLastMeter: 0 @@ -2351,6 +2359,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &6628358011295906335 GameObject: m_ObjectHideFlags: 0 @@ -2561,6 +2570,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &6794064008694923825 GameObject: m_ObjectHideFlags: 0 @@ -2673,6 +2683,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &7331846505223066426 GameObject: m_ObjectHideFlags: 0 @@ -2880,6 +2891,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &7470254353610657185 GameObject: m_ObjectHideFlags: 0 @@ -3090,6 +3102,7 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 --- !u!1 &8666002640045771141 GameObject: m_ObjectHideFlags: 0 @@ -3297,3 +3310,4 @@ MonoBehaviour: touchingObject: 0 touchingGround: 0 touchingStairs: 0 + touchingSit: 0 diff --git a/Assets/6_Scenes/Beep.unity b/Assets/6_Scenes/Beep.unity index 1da5879..144bd62 100644 --- a/Assets/6_Scenes/Beep.unity +++ b/Assets/6_Scenes/Beep.unity @@ -234,7 +234,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 83569712} serializedVersion: 2 - m_LocalRotation: {x: 0.020231633, y: 0.9743378, z: -0.097696625, w: 0.20177202} + m_LocalRotation: {x: 0.020231629, y: 0.9743378, z: -0.097696625, w: 0.20177199} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -392,7 +392,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 155411616} serializedVersion: 2 - m_LocalRotation: {x: 0.03223712, y: 0.96677077, z: -0.15566999, w: 0.20020498} + m_LocalRotation: {x: 0.032237124, y: 0.96677077, z: -0.15566999, w: 0.200205} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -516,7 +516,7 @@ Transform: m_GameObject: {fileID: 163243333} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.91, y: -32.51, z: 83.67} + m_LocalPosition: {x: -0.91, y: -32.51, z: 84.05} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -1097,7 +1097,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 8.93528 - m_SensorSize: {x: 36, y: 24} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 2.2 @@ -1250,7 +1250,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 0.01 - m_SensorSize: {x: 36, y: 24} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 1.9 @@ -1838,7 +1838,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 8.93528 - m_SensorSize: {x: 36, y: 24} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 2.2 @@ -1881,7 +1881,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 513050371} serializedVersion: 2 - m_LocalRotation: {x: 0.17829932, y: -0.22369511, z: 0.041663487, w: 0.9573056} + m_LocalRotation: {x: 0.17829932, y: -0.22369513, z: 0.041663494, w: 0.9573056} m_LocalPosition: {x: 9.355881, y: -3.2973547, z: -5.6164856} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -1919,7 +1919,7 @@ MonoBehaviour: LensShift: {x: -0.21, y: 0.15} GateFit: 1 FocusDistance: 10 - m_SensorSize: {x: 36, y: 24} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 2.2 @@ -2009,7 +2009,7 @@ Transform: m_GameObject: {fileID: 533893388} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 5.45, y: -29.72, z: 83.06} + m_LocalPosition: {x: 5.45, y: -30.62, z: 84.09} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -2141,7 +2141,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 8.93528 - m_SensorSize: {x: 36, y: 24} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 2.2 @@ -3001,7 +3001,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1178814724} serializedVersion: 2 - m_LocalRotation: {x: 0.020202018, y: 0.9790844, z: -0.16078894, w: 0.12301517} + m_LocalRotation: {x: 0.020202018, y: 0.9790844, z: -0.16078894, w: 0.123015165} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -3831,7 +3831,7 @@ Transform: m_GameObject: {fileID: 1591509191} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 9.6, y: -30.1, z: 83.3} + m_LocalPosition: {x: 11.19, y: -30.1, z: 83.3} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -5046,6 +5046,16 @@ PrefabInstance: value: objectReference: {fileID: 13400000, guid: 55fa6736a2a0f42ae9e0418644d109e6, type: 2} + - target: {fileID: 2711207082700034684, guid: 14d8283abcefffd4a916b8611ccd49fa, + type: 3} + propertyPath: m_LocalPosition.x + value: -4.845 + objectReference: {fileID: 0} + - target: {fileID: 2711207082700034684, guid: 14d8283abcefffd4a916b8611ccd49fa, + type: 3} + propertyPath: m_LocalPosition.y + value: -0.545 + objectReference: {fileID: 0} - target: {fileID: 3006033085249723243, guid: 14d8283abcefffd4a916b8611ccd49fa, type: 3} propertyPath: m_LocalPosition.x diff --git a/Assets/7_Scripts/Agent/Walker.cs b/Assets/7_Scripts/Agent/Walker.cs index 11a949e..23188a8 100644 --- a/Assets/7_Scripts/Agent/Walker.cs +++ b/Assets/7_Scripts/Agent/Walker.cs @@ -288,7 +288,7 @@ public class Walker : Agent // Check if model swapper is on if (m_ModelSwap) { - SwitchModelAfterFalling(); + //SwitchModelAfterFalling(); } UpdateOrientationObject(); @@ -380,22 +380,29 @@ public class Walker : Agent { if (m_ModelSwap) { - //InputSwitchModel(); + InputSwitchModel(); } } private void InputSwitchModel() { - if (Input.GetKeyDown(KeyCode.O)) - { - m_ModelSwapper.SwitchModel("Walker", this); - } - if (Input.GetKeyDown(KeyCode.P)) + if (Input.GetKeyDown(KeyCode.G)) { - m_ModelSwapper.SwitchModel("Stairs", this); + if( !m_FinishedSwap ) + { + m_FinishedSwap = true; + m_ModelSwapper.m_PastModel = m_ModelSwapper.m_currentModelName; + m_ModelSwapper.SwitchModel("Getup", this); + } + else + { + m_FinishedSwap = false; + m_ModelSwapper.SwitchModel(m_ModelSwapper.m_PastModel, this); + } } + } private void SwitchModelAfterFalling() diff --git a/Assets/ML-Agents/Timers/Beep_timers.json b/Assets/ML-Agents/Timers/Beep_timers.json index 0fe89f9..8f4487a 100644 --- a/Assets/ML-Agents/Timers/Beep_timers.json +++ b/Assets/ML-Agents/Timers/Beep_timers.json @@ -1 +1 @@ -{"count":1,"self":85.4708864,"total":86.2944977,"children":{"InitializeActuators":{"count":1,"self":0.0010007,"total":0.0010007,"children":null},"InitializeSensors":{"count":1,"self":0.0020039,"total":0.0020039,"children":null},"AgentSendState":{"count":4017,"self":0.0392186,"total":0.10328069999999999,"children":{"CollectObservations":{"count":804,"self":0.0306712,"total":0.0306712,"children":null},"WriteActionMask":{"count":804,"self":0.0019992,"total":0.0019992,"children":null},"RequestDecision":{"count":804,"self":0.0313917,"total":0.0313917,"children":null}}},"DecideAction":{"count":4017,"self":0.6761115,"total":0.6836808,"children":{"RayPerceptionSensor.Perceive":{"count":804,"self":0.0075692999999999993,"total":0.0075692999999999993,"children":null}}},"AgentAct":{"count":4017,"self":0.0336451,"total":0.0336451,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1710852750","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_02-Beep\\4_Unity\\Beep Final Git\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1710852836"}} \ No newline at end of file +{"count":1,"self":45.6146336,"total":46.2928968,"children":{"InitializeActuators":{"count":1,"self":0.0010107,"total":0.0010107,"children":null},"InitializeSensors":{"count":1,"self":0.0010039,"total":0.0010039,"children":null},"AgentSendState":{"count":2021,"self":0.0211559,"total":0.3031351,"children":{"CollectObservations":{"count":405,"self":0.0070731,"total":0.0070731,"children":null},"WriteActionMask":{"count":405,"self":0,"total":0,"children":null},"RequestDecision":{"count":405,"self":0.2749061,"total":0.2749061,"children":null}}},"DecideAction":{"count":2021,"self":0.3534794,"total":0.3560065,"children":{"RayPerceptionSensor.Perceive":{"count":405,"self":0.0025271,"total":0.0025271,"children":null}}},"AgentAct":{"count":2021,"self":0.0161058,"total":0.0161058,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1710853612","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_02-Beep\\4_Unity\\Beep Final Git\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1710853658"}} \ No newline at end of file