From 6acf1e9e1635bea6b3c2cb81979b1c4b4a80f4be Mon Sep 17 00:00:00 2001 From: Viviane Rochon Montplaisir Date: Fri, 26 Jun 2026 16:29:53 -0400 Subject: [PATCH] Replace hardcoded value 200f by agentRotationSpeed in MoveAgent() --- .../Examples/DungeonEscape/Scenes/DungeonEscape.unity | 2 +- .../Examples/DungeonEscape/Scripts/PushAgentEscape.cs | 2 +- .../Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlock.unity | 2 +- .../ML-Agents/Examples/PushBlock/Scenes/PushBlockCollab.unity | 2 +- .../ML-Agents/Examples/PushBlock/Scripts/PushAgentBasic.cs | 2 +- .../ML-Agents/Examples/PushBlock/Scripts/PushAgentCollab.cs | 2 +- com.unity.ml-agents/CHANGELOG.md | 3 +++ 7 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Project/Assets/ML-Agents/Examples/DungeonEscape/Scenes/DungeonEscape.unity b/Project/Assets/ML-Agents/Examples/DungeonEscape/Scenes/DungeonEscape.unity index 53ea5d53a41..8ab603c5c4e 100644 --- a/Project/Assets/ML-Agents/Examples/DungeonEscape/Scenes/DungeonEscape.unity +++ b/Project/Assets/ML-Agents/Examples/DungeonEscape/Scenes/DungeonEscape.unity @@ -2798,7 +2798,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: agentRunSpeed: 3 - agentRotationSpeed: 15 + agentRotationSpeed: 200 spawnAreaMarginMultiplier: 0.5 goalScoredMaterial: {fileID: 2100000, guid: df32cc593804f42df97464dc455057b8, type: 2} failMaterial: {fileID: 2100000, guid: a1daf31cdf41e484ca9ac33a5c6f524a, type: 2} diff --git a/Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/PushAgentEscape.cs b/Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/PushAgentEscape.cs index ea3f56541a1..3cf8ee4c530 100644 --- a/Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/PushAgentEscape.cs +++ b/Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/PushAgentEscape.cs @@ -63,7 +63,7 @@ public void MoveAgent(ActionSegment act) dirToGo = transform.right * 0.75f; break; } - transform.Rotate(rotateDir, Time.fixedDeltaTime * 200f); + transform.Rotate(rotateDir, Time.fixedDeltaTime * m_PushBlockSettings.agentRotationSpeed); m_AgentRb.AddForce(dirToGo * m_PushBlockSettings.agentRunSpeed, ForceMode.VelocityChange); } diff --git a/Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlock.unity b/Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlock.unity index aade4fdf10f..5e2a6ac1b3a 100644 --- a/Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlock.unity +++ b/Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlock.unity @@ -1900,7 +1900,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: agentRunSpeed: 3 - agentRotationSpeed: 15 + agentRotationSpeed: 200 spawnAreaMarginMultiplier: 0.5 goalScoredMaterial: {fileID: 2100000, guid: df32cc593804f42df97464dc455057b8, type: 2} failMaterial: {fileID: 2100000, guid: a1daf31cdf41e484ca9ac33a5c6f524a, type: 2} diff --git a/Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlockCollab.unity b/Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlockCollab.unity index 1beb76ea06a..b838b801763 100644 --- a/Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlockCollab.unity +++ b/Project/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlockCollab.unity @@ -723,7 +723,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: agentRunSpeed: 3 - agentRotationSpeed: 15 + agentRotationSpeed: 200 spawnAreaMarginMultiplier: 0.5 goalScoredMaterial: {fileID: 2100000, guid: df32cc593804f42df97464dc455057b8, type: 2} failMaterial: {fileID: 2100000, guid: a1daf31cdf41e484ca9ac33a5c6f524a, type: 2} diff --git a/Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentBasic.cs b/Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentBasic.cs index 3ae9c07cf50..f4bfaa446a7 100644 --- a/Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentBasic.cs +++ b/Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentBasic.cs @@ -157,7 +157,7 @@ public void MoveAgent(ActionSegment act) dirToGo = transform.right * 0.75f; break; } - transform.Rotate(rotateDir, Time.fixedDeltaTime * 200f); + transform.Rotate(rotateDir, Time.fixedDeltaTime * m_PushBlockSettings.agentRotationSpeed); m_AgentRb.AddForce(dirToGo * m_PushBlockSettings.agentRunSpeed, ForceMode.VelocityChange); } diff --git a/Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentCollab.cs b/Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentCollab.cs index 39c92e42258..8e9271e6e9a 100644 --- a/Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentCollab.cs +++ b/Project/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentCollab.cs @@ -52,7 +52,7 @@ public void MoveAgent(ActionSegment act) dirToGo = transform.right * 0.75f; break; } - transform.Rotate(rotateDir, Time.fixedDeltaTime * 200f); + transform.Rotate(rotateDir, Time.fixedDeltaTime * m_PushBlockSettings.agentRotationSpeed); m_AgentRb.AddForce(dirToGo * m_PushBlockSettings.agentRunSpeed, ForceMode.VelocityChange); } diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md index cf5d4e10963..ec0ea9e7bbb 100755 --- a/com.unity.ml-agents/CHANGELOG.md +++ b/com.unity.ml-agents/CHANGELOG.md @@ -14,6 +14,9 @@ and this project adheres to - Fixed a bug when using LSTM and SAC where the buffer might contain non-integer numbers of sequences. (#6301) - Fixed mixed CPU/GPU computation by ensuring tensors share a consistent device in the trainer; Updated training devices. (#6303) +#### Examples +- Replace hardcoded value 200f by agentRotationSpeed in MoveAgent() (#6306) + ## [4.0.3] - 2026-04-17 ### Minor Changes #### com.unity.ml-agents (C#)