void Update() { Transform transWheel; // if transmission is manual then check for gear change request // Button up/down detection happens at display frequency, so the check is performed here if (!transmission.GetAutomatic) { if (Input.GetButtonDown("GearShiftUp")) { transmission.GearShiftUp(); } if (Input.GetButtonDown("GearShiftDown")) { transmission.GearShiftDown(); } } // update wheel mesh positions to match wheel collider positions // slightly convoluted correction for tyre compression which must be corrected locally when WC position update is only available globally for (int i = 0; i < 4; i++) { wC[i].GetWorldPose(out Vector3 wcPosition, out Quaternion wcRotation); transWheel = wC[i].gameObject.transform.GetChild(0); transWheel.transform.position = wcPosition; transWheel.transform.localPosition = new Vector3(transWheel.transform.localPosition.x, transWheel.transform.localPosition.y, transWheel.transform.localPosition.z); transWheel.transform.rotation = wcRotation; } }