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

Units of Rigidbody.angularVelocity

Discussion in 'Scripting' started by besuser, Nov 3, 2007.

  1. besuser

    besuser

    Joined:
    Oct 9, 2007
    Posts:
    292
    Sorry to post 2 questions so soon after one another. What are the units of Rigidbody.angularVelocity? I'm hoping rpm (revolutions per minute).

    Thanks again!
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's relative...depends on the mass of your object. The more mass, the more units (of whatever they are ;) ) you need to get it to rotate.

    --Eric
     
  3. besuser

    besuser

    Joined:
    Oct 9, 2007
    Posts:
    292
    Crazy! Thanks!
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Oh, wait...I was thinking of adding force. You're asking about angular velocity. Oops. :oops: In that case, it's obviously not relative to the mass, sorry. It's not RPM though...a quick test shows that it seems to be 10x RPM. i.e., a value of 1 does 10 RPM, 4 does 40 RPM, etc.

    --Eric
     
  5. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    it's probably radians per second.

    (Math lesson: radian is the length around the circumference of a circle with a radius of 1. That means that π radians = 180 degrees, 2π = 1 revolution. This jives with being roughly 10x the RPM equivalent (in fact it'd be 60 / 6.28 times RPM) and most of the under-the-surface math in Unity is measured in radians (such as the Mathf trig functions)
     
  6. drudiverse

    drudiverse

    Joined:
    May 16, 2013
    Posts:
    218
    I have a problem when setting rigidbody.angularVelocity = Vector3.one*10;
    EDIT- found the solution, the default limit is 7, have to change it with: Rigidbody.maxAngularVelocity

    AngularVelocity is vector 3, and it's length equals speed, so if you have angular drag, the object slowly spins slower after a knock, the 3 values of the Vector3 will stay balanced and will all 3 reduce proportionally.

    Here is a test:
    it takes 26 fixed frames for rigidbody to rotate 180, default fixed update is 30 so it's spinning once every 1.73 seconds, 35 revs per minute . the length of the Vector 3 is about 6.5 units. if i take away angular drag on object i could know the precise number as angular velocity would not decrease over time as it is in the list


    $angvel.jpg

    EDIT_ sorry maybe i was talking nonsense, when angularVelocity (-100.0, 0.0, 0.0) it takes exactly 9 fixedupdate frames to go 360 degrees, to 1-2 percent precision.
     
    Last edited: May 11, 2014
  7. Gumpert

    Gumpert

    Joined:
    Dec 30, 2012
    Posts:
    38
    Ok, I tested it out - unity measures angular velocity in radians per second.
    If you don't know what radians are, they're a unit for measuring angles. There are 2*PI radians in 360 degrees. If you want to convert radians per second to rpm, multiply by 30/PI, and to convert the other way multiply by PI/30.
     
    jbecana and PrimalCoder like this.
  8. jbecana

    jbecana

    Joined:
    Feb 14, 2012
    Posts:
    22
    Unity doc writers, please, may you add this info in the docs?.
     
  9. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    They don't reliably read the forums, but you can report a documentation page in the bug reporter.