Skip to content

Commit

Permalink
Added Rigidbody Extensions for backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGadget1024 committed May 5, 2024
1 parent d635aa6 commit 4f699be
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Assets/Mirror/Core/Tools/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 4f699be

Please sign in to comment.