Search Unity

Understanding how physics work

Discussion in 'Physics' started by leno45, Nov 9, 2019.

  1. leno45

    leno45

    Joined:
    Nov 9, 2019
    Posts:
    2
    I m new to unity and currently learning how unity physics works.
    I have trouble with understanding the gravity.
    Basically I put object at Y - 9.8, and beneath is the floor at position 0,0,0 with Y-scale 0.01.
    Problem is when i run the game and object starts falling, after one second he is around half way to the floor.

    Start position of object is (0, 9.8, 0),
    after one second is (0,4.796882, 0),
    velocity after one second is -9.81002,

    I m not expert in physics but shouldnt object after one second be very close to the floor ?
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,776
    As far I am aware, default gravity in Unity is approx 2 times slower. Yes it is weird. At least in my experience.

    I know, I haven't been using it, if I want simulate realistic behaviour.
    Otherwise stuff looked in slow motion like.
    I don't remember exactly now, but increasing sample time from 0.02s, to 0.01s improves that behavior.
    But comes with own performance cost.
     
  3. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    The behaviour is completely fine. Gravity of -9.81 means "acceleration" of 9.81 meters per second squared. Put that into the formula for distance, which is:
    x = 0.5 * acceleration * time^2, you get 0.5*9.81 m as the travelled distance. The object should reach the floor after sqrt(2) seconds (if it's a point)
     
  4. leno45

    leno45

    Joined:
    Nov 9, 2019
    Posts:
    2
    Rookie mistake, I dont know how I got in my head that if acceleration is 1m/s^2 he should travel the distance of 1m in one second. Forgot that it is actually the average. 0 + 1 all divided with 2 times time. Result is then 0.5.
    Thank you for help guys.