[SerializeField] private Rigidbody rb;
[SerializeField] private float rbMaxSpeed;
[SerializeField] private float rbMag;
private void FixedUpdate()
{
rbMag = rb.velocity.magnitude; // Total xyz magnitude
if (rb.velocity.magnitude > rbMaxSpeed)
{
rb.velocity = Vector3.ClampMagnitude((Vector3)rb.velocity,rbMaxSpeed);
}
}