public static Boolean rightRobot(List <GameObject> wheelcolliders, Transform parent) { Quaternion q = new Quaternion(); List <Vector3> wheels = new List <Vector3>(); foreach (GameObject collider in wheelcolliders) { wheels.Add(collider.transform.position); } Vector3 com = AuxFunctions.TotalCenterOfMass(parent.gameObject); Debug.Log(com.y < wheels[0].y); q.SetFromToRotation(parent.localToWorldMatrix * Vector3.up, parent.localToWorldMatrix * Vector3.down); if (com.y > wheels[0].y) { return(false); } else { parent.localRotation *= q; return(true); } }