Search Unity

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:
    191
    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?