Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


angularDamping

The angular damping of the Rigidbody2D angular velocity.
Read time 1 minuteLast updated 11 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.Physics2DModule
public float angularDamping { get; set; }

Remarks

Damping can be used to reduce the Rigidbody2D.angularVelocity (angular speed) of a Rigidbody2D over time.
Zero indicates that no damping should be used whereas higher values increase the damping, effectively slowing down the rotational movement faster. Unlike contact friction, angular damping is always applied.
Note: The following formula is how the angular damping is applied
angularVelocity *= 1.0f / ( 1.0f + simulation-time-step * angularDamping )
Additional Resources: Rigidbody2D.linearDamping.

Examples

using UnityEngine;public class ExampleClass : MonoBehaviour{ private Rigidbody2D rb; void Start() { rb = GetComponent<Rigidbody2D>(); // Start the object spining fast. rb.angularVelocity = 45f; // Turn-off the angular damping. rb.angularDamping = 0f; } void Update() { // Set a large angular damping to slow down the spin fast. if (Input.GetKeyDown("space")) rb.angularDamping = 0.8f; }}