Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Sphere rigidbody - Doesnt stop rolling - Wanted:Insight - Offer:Workaround

Discussion in 'Physics' started by meat5000, Apr 15, 2016.

  1. meat5000

    meat5000

    Joined:
    Mar 5, 2013
    Posts:
    118
    So many people are STILL experiencing the bug whereas a sphere with a rigidbody wont stop rolling. This problem completely ignores all drag and friction and even when applying opposing forces it becomes apparent that the rigidbody reaches a certain low velocity and then starts speeding up again. Its like its an issue of friction vs ground-collision reaction force.

    I played with it for quite some time and eventually came to the realisation that Setting Rigidbody.inertiaTensorRotation to (0.01, 0.01, 0.01, 1) from the default (0, 0, 0, 1) did the trick in making the rigidbody eventually come to a stop.

    What I didnt notice for quite some time was that setting the value wasnt enough as each frame it was being reset back to (0, 0, 0, 1)! So I moved the line to inside FixedUpdate and spammed the value. This worked.

    Now here's what I come to ask:

    Is the inertiaTensorRotation supposed to be (0,0,0,1) by default and after it is set is it supposed to revert to its default? Is this the cause of the bug or have I just got lucky?
     
    Last edited: Apr 15, 2016
  2. SmithySFC

    SmithySFC

    Joined:
    Jan 15, 2021
    Posts:
    11
    Thanks so much for posting this solution - mesh colliders just arent respecting the physics properly until i add this line of code....in c#
    GetComponent<Rigidbody>().inertiaTensorRotation = new Quaternion(0.01f, 0.01f, 0.01f, 1);
     
  3. AlTheSlacker

    AlTheSlacker

    Joined:
    Jun 12, 2017
    Posts:
    326
    I could not replicate this problem in 2020.2.1f1. I tried very small masses and uniformly scaling at 0.01 and it seemed to work fine. When the rb velocity got to 0.01 the physics solver set it to 0,0,0 and there it remained. Perhaps this was a bug in a previous version? Can you post a trivial replicator? I set the initial velocity via rb.velocity from the start method.
     
    SmithySFC likes this.