Added Rigidbody Extensions for backwards compatibility

This commit is contained in:
MrGadget 2024-05-05 01:15:29 -04:00
parent d635aa68dd
commit 4f699be7d4

View File

@ -108,5 +108,40 @@ public static void GetPositionAndRotation(this Transform transform, out Vector3
rotation = transform.rotation;
}
#endif
#if !UNITY_6000_0_OR_NEWER
// Rigidbody velocity was renamed to linearVelocity in Unity 6.0.0
public static Vector3 linearVelocity(this Rigidbody rb)
{
return rb.velocity;
}
public static void linearVelocity(this Rigidbody rb, Vector3 value)
{
rb.velocity = value;
}
// Rigidbody drag was renamed to linearDamping in Unity 6.0.0
public static float linearDamping(this Rigidbody rb)
{
return rb.drag;
}
public static void linearDamping(this Rigidbody rb, float value)
{
rb.drag = value;
}
// Rigidbody angularDrag was renamed to angularDamping in Unity 6.0.0
public static float angularDamping(this Rigidbody rb)
{
return rb.angularDrag;
}
public static void angularDamping(this Rigidbody rb, float value)
{
rb.angularDrag = value;
}
#endif
}
}