Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question Reset a game

Discussion in 'ML-Agents' started by yasinmasmoudi, Jan 4, 2023.

  1. yasinmasmoudi

    yasinmasmoudi

    Joined:
    Nov 15, 2021
    Posts:
    6
    Hello,

    I want to train an agent to move a machine, and as with each ml-agent project, the environment need to get reset after each episode. The problem with my program is that my machine is connected via joints so I can't just reset the transform.position of each part of the machine.

    Is there a simple and easy way that allows me to instantly reset the environment ( as if I would reload the scene ) ?
     
  2. yasinmasmoudi

    yasinmasmoudi

    Joined:
    Nov 15, 2021
    Posts:
    6
    So far I have the machine go back to it's initial position manually but it takes at least 5 seconds, during which the agent has already started it's new episode and I believe that this messes with the training
     
  3. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    175
    have you tried iterating calls to Physics.Simulate() a few times, after applying forces to the joints for reset, but before returning from your reset function?