unity rigid body speed code example
Example 1: how to get rigidbody speed in unity
var speed = rigidbody.velocity.magnitude;
Example 2: get an object speed unity rigidbody
float maxSpeed = 1.0f; // units/sec void FixedUpdate() { Rigidbody rb = GetComponent<Rigidbody>(); Vector3 vel = rb.velocity; if (vel.magnitude > maxSpeed) { rb.velocity = vel.normalized * maxSpeed; } }