Unity Comment obtenir la vitesse des voies latérales d'un objet

Rigidbody rb = GetComponent<Rigidbody>();
Vector3 worldVelocity = rb.velocity;
Vector3 localVelocity = transform.InverseTransformVector(worldVelocity);
//This gives velocity in all directions sideways is on the x axis the thread gives more info
Powerful Peccary