Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Training timescale and physics issues

Discussion in 'ML-Agents' started by mbaske, Jan 22, 2021.

  1. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    Hi, am I right to assume that high training timescales can cause issues with complex physics environments? Is there any straight-forward way of testing at what timescale the physics engine can't keep up any longer? How do you guys usually pick your timescale values? Thanks!
     
  2. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    I need to look into this some more. Changing the timescale shouldn't affect the fixedDeltaTime (which is what physics uses, and what ML-Agents uses by default), so unless you have any logic in an Update() method, I'm not actually sure what will break down.
     
    mbaske likes this.
  3. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    I asked the rest of the team about this, and we don't have a good answer. Using a higher timescale will change the relative frequency of FixedUpdate to Update calls, but as long as you're only using physics and ML-Agents (and really, what else could you possible want?!), I think they'll behave the same at higher time scales. You'll just need to make sure that you don't do anything that affects the simulation outside of the FixedUpdate calls, and only do things based on Time.fixedDeltaTime (which doesn't change with timeScale) on not Time.deltaTime.

    There were some anecdotal reports of physics objects tunneling at higher timescales, but that was for cases outside of our examples, and may have had to do with other game systems running in Update instead.
     
    Sab_Rango and mbaske like this.
  4. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
  5. Sab_Rango

    Sab_Rango

    Joined:
    Aug 30, 2019
    Posts:
    121
    Yeah! Any physics call even without fixedDeltatime must be called in fixedUpdate()
    I encountered myself condition like jittering articulation body by force in every Update()
    But it works smoothly in fixed update!