linearDamping
The linear damping of the Rigidbody linear velocity.
Read time 1 minuteLast updated 7 days ago
Definition
- Type: Property
- Namespace: UnityEngine
- Assembly: UnityEngine.PhysicsModule
public float linearDamping { get; set; }
Remarks
linearDamping can be used to slow down an object.
Zero indicates that no damping should be used whereas higher values increase the damping, effectively slowing down the linear motion faster.
Note: The following formula is how the linear damping is applied:
linearVelocity *= ( 1 - linearDamping * dt )Additional Resources: Rigidbody.angularDamping.
Examples
using UnityEngine;using UnityEngine.InputSystem;public class ExampleClass : MonoBehaviour{ public Rigidbody rb; void Start() { rb = GetComponent<Rigidbody>(); } void OpenParachute() { rb.linearDamping = 20; } void Update() { if (Keyboard.current.spaceKey.isPressed) OpenParachute(); }}