Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Issues with physics velocity in ECS

Discussion in 'Data Oriented Technology Stack' started by huhund, Jun 11, 2019.

  1. huhund

    huhund

    Joined:
    Aug 14, 2014
    Posts:
    7
    I'm trying the following thing.
    * empty scene
    * add a Cube, remove BoxCollider
    * add PhysicsBody, set initial velocity to (1,0,0)
    * add PhysicsShape
    * add ConvertToEntity

    At first it seems to work correctly but changing the fixed timestep in project settings doesn't work correctly. The cube no longer moves 1 unit per second if I change that.

    Also if my frames rate drops to say 20fps I can clearly see that my cube moves way slower.

    Are these know work in progress issues or I'm I doing something wrong?

    editor: 2019.1.6f1
    entities: 0.0.12
    unity physics: 0.1.0

    Best, Hu
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,540
  3. huhund

    huhund

    Joined:
    Aug 14, 2014
    Posts:
    7
    Yeah, my repro is extreme simple. I'll assume it's a known issue and it will be refactored at some point. Anyway, I'm not close to finishing my game anyway so I can wait.
     
  4. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,068
    Unity Physics is framerate dependent atm, they run simulation with assumption you got 0.02 fixed deltatime but they actually run it once per each update afaik. This causes builds to have absurdly fast physics unless you lock the update speed with vsync etc.

    Afaik this happened because of the SimulationGroup change in Entities, they'll fix it eventually.
     
  5. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    168
    There is an example of implementing a fixed time step in the Entity Samples. You have to disable the world update and run it on a MonoBehavior FixedUpdate instead.
     
  6. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    34
    Any timeframe when this will be fixed or where i can find the example? :)
     
  7. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    168
  8. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,068