public void SetInputs(int gearInput, float throttleInput, float brakePressure) { // MGU mgu.gearInput = gearInput; mgu.throttleInput = throttleInput; mgu.brakePressure = brakePressure; // Wheel brakes float brakeTorque = mgu.GetWheelBrakeTorque(brakePressure); m_leftWheel.AddBrakeTorque(brakeTorque); m_rightWheel.AddBrakeTorque(brakeTorque); }
// Convert the input state into torque and brake in the track void SendInputToTrack(int input, DirectDrive track, Wheel w0, Wheel w1, Wheel w2, Wheel w3) { track.maxMotorTorque = trackTorque; track.maxRpm = trackRpm; if (input == 0) { float brakeTorque = trackBrakeTorque * 0.25f; // 4 wheels per track w0.AddBrakeTorque(brakeTorque); w1.AddBrakeTorque(brakeTorque); w2.AddBrakeTorque(brakeTorque); w3.AddBrakeTorque(brakeTorque); track.motorInput = 0.0f; } else { track.motorInput = Mathf.Sign(input); } }