private void OnTriggerExit(Collider other) { GearRotation otherGear = other.GetComponent <GearRotation>(); if (drivingID > 0 && drivingMotor && other.GetInstanceID() == drivingMotor.GetInstanceID()) { drivingMotor = null; rigidBody.angularVelocity = AngularVelocity; drivingID = 1000; } }
private void OnTriggerStay(Collider other) { if (drivingID > 0 && other.tag.Equals("Gear")) { GearRotation otherGear = other.GetComponent <GearRotation>(); if (otherGear.drivingID < drivingID) { drivingID = otherGear.drivingID + 1; drivingMotor = otherGear; rigidBody.angularVelocity = AngularVelocity; } } }
private void OnTriggerEnter(Collider other) { if (drivingID > 0 && other.tag.Equals("Gear")) { GearRotation otherGear = other.GetComponent <GearRotation>(); if (otherGear.drivingID < drivingID) { drivingID = otherGear.drivingID + 1; drivingMotor = otherGear; rigidBody.angularVelocity = AngularVelocity; if (load) { load = false; StartCoroutine(GearStillMoving()); } } } }