ppo-SnowballTarget / Project /Assets /ML-Agents /Examples /PushBlockWithInput /Scripts /GoalDetectWithInput.cs
Download Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs from ashish2244/ppo-SnowballTarget: direct link, hf CLI and curl.
- Browser
- Download file 748 Bytes
-
https://huggingface.co/ashish2244/ppo-SnowballTarget/resolve/main/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs
- Command line
-
hf download hf://ashish2244/ppo-SnowballTarget/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs
-
curl -L -o GoalDetectWithInput.cs https://huggingface.co/ashish2244/ppo-SnowballTarget/resolve/main/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs
748 Bytes
| //Detect when the orange block has touched the goal. | |
| //Detect when the orange block has touched an obstacle. | |
| //Put this script onto the orange block. There's nothing you need to set in the editor. | |
| //Make sure the goal is tagged with "goal" in the editor. | |
| using UnityEngine; | |
| public class GoalDetectWithInput : MonoBehaviour | |
| { | |
| /// <summary> | |
| /// The associated agent. | |
| /// This will be set by the agent script on Initialization. | |
| /// Don't need to manually set. | |
| /// </summary> | |
| [] | |
| public PushBlockWithInputAgentBasic agent; // | |
| void OnCollisionEnter(Collision col) | |
| { | |
| // Touched goal. | |
| if (col.gameObject.CompareTag("goal")) | |
| { | |
| agent.ScoredAGoal(); | |
| } | |
| } | |
| } | |