public virtual void UpdateWheelVisuals(WheelObject wheel) { // Update Wheel position / rotation based on WheelColliders World Pose if (wheel != null && wheel.WheelVisual != null) { Vector3 position; Quaternion rotation; wheel.Wheel.GetWorldPose(out position, out rotation); wheel.WheelVisual.transform.position = position; wheel.WheelVisual.transform.rotation = rotation; } }
public virtual void UpdateWheelTorque() { float torqueInput = EngineOn ? MotorInput : 0; // Add torque / rotate wheels for (int x = 0; x < Wheels.Count; x++) { WheelObject wheel = Wheels[x]; // Steering if (wheel.ApplySteering) { wheel.Wheel.steerAngle = MaxSteeringAngle * SteeringAngle; } // Torque if (wheel.ApplyTorque) { wheel.Wheel.motorTorque = MotorTorque * torqueInput; } UpdateWheelVisuals(wheel); } }