void SetParameterss(RaycastWheelSimple _RCWScript, float _radius) { _RCWScript.mass = wheelMass; _RCWScript.maxSuspension = WheelMaxSuspension; _RCWScript.spring = WheelSpring; _RCWScript.damper = WheelDamper; if (_radius != -1f) { _RCWScript.radius = _radius; } }
void Initialize() { // Cache a reference to our car's transform carTransform = transform; // cache the rigidbody for our car carRigidbody = GetComponent <Rigidbody>(); // cache our vector up direction carUp = carTransform.up; // cache the mass of our vehicle carMass = GetComponent <Rigidbody>().mass; // cache the Forward World Vector for our car carFwd = Vector3.forward; // cache the World Right Vector for our car carRight = Vector3.right; // call to set up our wheels array setUpWheels(); // we set a COG here and lower the center of mass to a //negative value in Y axis to prevent car from flipping over carRigidbody.centerOfMass = new Vector3(0f, -1.7f, .35f); audio = GetComponent <AudioSource> (); frontLeftRayCast = frontLeftWheel.GetComponentInParent <RaycastWheelSimple> (); frontRightRayCast = frontRightWheel.GetComponentInParent <RaycastWheelSimple> (); }