Search Unity

Extreme Physics TimeSetepping

Discussion in 'Physics' started by EliJNemer, Oct 23, 2019.

  1. EliJNemer

    EliJNemer

    Joined:
    Aug 3, 2019
    Posts:
    123
    hello,

    i am building a game and i wanted to ask what is the lowest recomended timestep for the fixed update.

    the reason why is becasue i would like to set it to 1/5000 or 0.0002.. the reason why want to do this, is so:

    two balls passing eachother at high speeds at a timestep of 0.02 or 0.01 even though they do not hit physically they still hit. and it looks wrong..

    now two balls at a time step of 0.001, 0.002, some velocities passing eachother do not hit and seems realistic.
    now when i would like to generate a ray cast with line render to show the collision path of the hit ball, it is normal to imagine that it would be the unit vector of direction between the two balls on contact. but when i do the shot, the ball is slightly off the line rendered.. as if the first ball is bigger than it is.. the angle is too small..

    when i decrease the time step it gradually becomes more accurate..

    so my question is it ok to decrease to 0.0002 physics timestep..

    im obviously thinking this is way too low. i should have it at a maximum of 1/500, and try fix the issue in another way..
     
  2. EliJNemer

    EliJNemer

    Joined:
    Aug 3, 2019
    Posts:
    123
    my real problem is that the faster the speed the more error there is.. it seems as though the colliders get bigger the faster the speed. it is almost as if the sphere collider is trying to catch up to the object, but at higher speeds it is a minute amount off, thus creating this inconsistency. perhaps it has something to do with the collision detection which is currently set on continous speculative
     
  3. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Set it to conrinous dynamic for fast moving object, just continuos to static objects that collide with fast moving objects.
    The speculative is new and i think it works like the dynamic one but cuts some of the heavy calculations by (as the name suggests) doing some speculations thus leading to a (greater) degree of error.

    Setting your fixed time depends on a lot things - code complexity, project scale, hardware used, etc.
    Only testing will tell.
     
    EliJNemer likes this.
  4. EliJNemer

    EliJNemer

    Joined:
    Aug 3, 2019
    Posts:
    123
    i understand that when set to speculative continuous it may create a ghost collision.. and this is the reason why the faster the speed of the first ball, the more error and thus ghost collision there is.. but also if i set the collision detection to Continous dynamic for the fast moving object and continous for the object going to be hit at larger angles like where the first ball almost skims the second it just passes through.. im guessing here the collision is not detected, since the collsion suface is much less and and the speed is great.. thus it passes through and no collisison happens.. how can this be fixed>?