Search Unity

LinearSleepTolerance and AngularSleepTolerance

Discussion in 'Physics' started by mosh999, May 27, 2019.

  1. mosh999

    mosh999

    Joined:
    Feb 22, 2019
    Posts:
    18
    Hi all,

    I would like to know how the following settings are supposed to work: LinearSleepTolerance & AngularSleepTolerance.

    My assumption of the meaning of Linear Sleep Tolerance is that it will take the magnitude of the velocity vector of a rigidbody2d and if the magnitude is below the 'tolerance' value it will make the object sleep. If so, it is not working the way I expect.

    Firstly, I have been setting these parameters to various values, but it seems to have no effect. For example, I've set LinearSleepTolerance to 2.4.
    When my ball reaches a very slow velocity, such as (0.8,0.4), where the magnitude of the linear velocity is clearly less than 2.4, it continues to move around. Should the LinearSleepTolerance not cause it to fall asleep?

    Secondly, I've tried setting Angular Sleep Tolerance = 1, and then monitored the ball's angular velocity to see that even when angular velocity is around 0.5 or 0.8, the ball still does not sleep. The time to sleep is set to '1', so my expectation would be that it will sleep within 1 second once the conditions are satisfied.

    Please can someone explain in detail:
    - What the purpose of Linear/Angular Sleep Tolerance is
    - How to correctly use these settings for its intended purpose.

    To clarify, my 'intention' for using these settings was to find a way of bringing a bouncing ball to 'rest' when it reaches a state of infinite bouncing.

    Look forward to your response.