Search Unity

Question Gravity feels like it's ~10x what it should be.

Discussion in 'Physics for ECS' started by EagL-, Dec 1, 2020.

  1. EagL-

    EagL-

    Joined:
    Dec 9, 2016
    Posts:
    24
    Entities fall really fast compared to gameobjects. I have to set the gravity factor to 0.1 for each entity for them to accelerate at around the same rate as gameobjects. What's causing this?
     
  2. EagL-

    EagL-

    Joined:
    Dec 9, 2016
    Posts:
    24
    So I played around a bit with different gravity factors and custom gravity scripts and all kinds of stuff.
    I tried changing the fixed timestep in project settings to a value close to time.deltaTime, in my case from 0.03 to ~0.004, and that affected the entity (even though it shouldn't?) and made it fall at the same rate as its gameobject equivalent. What's going on here?

    Edit: did a small test with a script that pauses the editor after 3 seconds.
    0.03 fixed timestep: gameobject (y=-44.6), entity (y=-2615.7)
    0.004 fixed timestep: gameobject (y=-43.7), entity (y=-40.8)
     
    Last edited: Dec 2, 2020
  3. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    It's definitely related to the rate of stepping physics. Which version of physics are you using? In one of the recent releases we moved physics to step as part of the FixedStepSimulationSystemGroup, meaning it steps at fixed rate. However, the rate at which we step is Time.DeltaTime. Does that give any hints?

    Note that you might still get a small difference based on when gravity is applied. For example, physics engines may choose to apply gravity and then step, or the other way around, so the first step can be simulated with gravity or without it.