Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to achieve framerate-independent movement?

Discussion in 'Physics Previews' started by Deleted User, Aug 16, 2019.

  1. Deleted User

    Deleted User

    Guest

    How physics systems are updated? Are they called every Update or FixedUpdate?

    If I set the velocity of a PhysicsVelocity to a constant value, the movement will be framerate dependent. The object will move faster with higher fps.
    How can I achieve framerate independent movement?
     
    AlanMattano likes this.
  2. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    You probably talk about Unity Physics package now. It's a known issue that it's not updated properly, it's been broken since the first public version.
     
    AlanMattano likes this.
  3. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    @rizu Can you pass the link the bug report so that we can vote it fr fixing?
     
  4. Deleted User

    Deleted User

    Guest

    A workaround is to disable auto creation for physics systems and manually update them in FixedUpdate.

    But Package Manager is really s**t and when you modify any package it overwrites the modifications. Another workaround for that is to copy the source code and include in your assets folder.
     
  5. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    If you ever need to modify package, the intended workflow is that you just move the package from your projects library/packagecache into packages folder. Any modification you do on the local packages folder (same folder where your manifest.json is) will stay intact and nothing will be overwritten unless you manually ask an update or remove the local package.
     
  6. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Not sure if there's a bug report but it's been discussed with Unity staff working with Unity Physics countless times from the beginning of the whole deal.
     
  7. Deleted User

    Deleted User

    Guest

    Thank you. Didn't know that.

    Another note, I don't think Unity Physics can fix this issue until ECS provides a FixedUpdate system group. So it's better to ask this feature from ECS devs.
     
  8. elcionap

    elcionap

    Joined:
    Jan 11, 2016
    Posts:
    138
    There is none since the "bug" is a missing feature on the ECS part. Formerly the simulation system group should run in the FixedUpdate subsystem in the player loop. But not everyone needs the simulation on the FixedUpdate, so they moved to the Update subsystem till an implementation to select where the simulation run be elaborated. In meantime the DOTS Physics was released (preview) but uses Time.fixedDeltaTime and simulation group. Till this feature is designed/finished/released (they affect a lot more than DOTS Physics, but mutiplayer tick, send rate, etc), we need to manually tick the simulation on FixedUpdate, cap the framerate or something like this.

    Obs.: They didn't give any timeframe for this feature.
    Obs2.: You can find more information about searching by the ComponentSystemGroup introduction. Before the use of ComponentSystemGroup, all systems where added to player loop subsystems and by the time of the change this discussions were made.

    []'s
     
    AlanMattano likes this.
  9. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
  10. CorneliusCornbread

    CorneliusCornbread

    Joined:
    Jun 21, 2017
    Posts:
    32
    So any updates on this bug? It's been 3 months and I'm still experiencing the issue. I want to start a project with this but I can't if it's going to be tied to framerate.