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. Dismiss Notice

Question Activating gravity in OnEpisodeBegin function

Discussion in 'ML-Agents' started by zukini_kun, Jul 28, 2021.

  1. zukini_kun

    zukini_kun

    Joined:
    Jul 28, 2021
    Posts:
    4
    Hello,

    I am currently trying to learn a game using ML-Agents in which the agents grasps randomly placed objects out of a bin. After the initial experiments have started to work, I was intending to make my scene more and more realistic, up to the point where I now don't want to place objects randomly in the bin, but rather let them fall in from above at the beginning of each episode.
    However, whenever I am starting the game, the objects fall for a split-second and then freeze. Deactivating the Agent-Scripts makes the objects fall on game start, so everything should be working regarding the RigidBody-Scripts etc.

    My question is: Is there any method or design somebody here has made good experience with in order to handle gravity using the Ml-Agents training routine ? Or how to make these kinds of things work in general.

    Thanks in advance!
     
  2. ruoping_unity

    ruoping_unity

    Unity Technologies

    Joined:
    Jul 10, 2020
    Posts:
    134
    Since we don't have access to your project it's a bit hard to debug your custom environment.
    But in terms of physics and gravity, ML-Agents should work just fine without significant changes in your scene. We have plenty of examples documented here which some of them also involves gravity. For example the 3DBall scene has a ball falling down on agent's head at the beginning and the agent should learn to control the ball and not drop it.