Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

minimum rigidbody velocity?

Discussion in 'Physics' started by Innovine, Oct 17, 2018.

  1. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Is there some kind of minimum threshold for the velocity of a rigidbody, below which it snaps to zero?

    While one rigidbody is pushing a target rigidbody (gently), I can see the target rigidbody velocity as 0.07... Then the colliders separate, and the target rigidbody becomes 0 (as does its angular velocity).

    The rigidbody drag and angular drag are set to 0.
    I have tried repeatedly calling WakeUp(), it does not make a difference.

    Am I doing something wrong which causes the velocity to go to 0? If i give my target a good solid push it seems to continue moving just fine. Only the motions where i impart a gentle low force seem to trigger this.
     
  2. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    One other thing that might be involved here, the rigidbody doing the pushing... I am moving it with transform.position until the collision, and which point I stop doing that and start calling rb.AddForce(). When the collision ends I go back to using transform.position. Perhaps there's a frame when ending the collision where these overlap or occur out of sequence. I am not sure about this. Could that be relevant?
     
  3. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    I also notice that the problem only exists at the start. Bodies which are stationary are difkficult to get into motion. I can nudge them and move them gently, but they stop moving again immediately. But, once they actually start moving by themselves, I can nudge them almost to a standstill, yet they will never truely ccome to rest (which is what i want).
    Is there some threshold required to wake up a physics body and get it started in motion? Does calling WakeUp not do this?
     
  4. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    It maybe because of setting the transform position.

    Unity strongly says that you should use rb.move, or "just" navigate with forces

    Anyway, try it without touching the transform
     
  5. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    I just found out that the sleepThreshold isn't velocity, its "mass-normalized energy", whatever that means. So anyway setting rb.sleepThreshold to 0 works.
     
  6. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    I dont know what the normalized part is but id recon it calculates by energy (mass * speed) basically

    Glad you got it to work
     
  7. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Since sleepAngularVelocity is deprecated, I'm guessing the angular momentum is added in too, in some way.