// private string m_wheelManufacturer; public Car(eColor i_color, eCarNumberOfDoors i_numberOfDoors, VehicleInformation i_vehicleInformation, string i_wheelManufacturer) : base(i_vehicleInformation) { m_wheelInformation = new WheelInformation(32, 4, i_wheelManufacturer); base.WheelInformation = m_wheelInformation; m_numberOfDoors = i_numberOfDoors; m_color = i_color; }
public Motorcycle(eLicense i_license, int i_engineVolume, VehicleInformation i_vehicleInformation, string i_wheelManufacturer) : base(i_vehicleInformation) { m_license = i_license; m_engineVolume = i_engineVolume; m_wheelInformation = new WheelInformation(32, 2, i_wheelManufacturer); base.WheelInformation = m_wheelInformation; }
protected override void setupWheel(GameObject wheelTransform, Rigidbody handle, WheelInformation wheelConfigs) { handle.position = Vector3.zero; Rigidbody body = wheelTransform.AddComponent <Rigidbody>(); body.mass = wheelConfigs.Mass; body.angularDrag = wheelConfigs.RunDrag; body.drag = wheelConfigs.AirDrag; body.maxAngularVelocity = wheelConfigs.MaxRotationSpeed; SphereCollider collider = wheelTransform.AddComponent <SphereCollider>(); collider.material = wheelConfigs.Material; wheelTransform.AddComponent <ConstantForce>(); ConfigurableJoint joint = wheelTransform.AddComponent <ConfigurableJoint>(); joint.connectedBody = handle; joint.anchor = Vector3.zero; joint.angularXMotion = ConfigurableJointMotion.Free; joint.angularYMotion = ConfigurableJointMotion.Locked; joint.angularZMotion = ConfigurableJointMotion.Locked; joint.xMotion = ConfigurableJointMotion.Locked; joint.yMotion = ConfigurableJointMotion.Locked; joint.zMotion = ConfigurableJointMotion.Locked; joint.axis = Vector3.zero; joint.secondaryAxis = Vector3.zero; joint.autoConfigureConnectedAnchor = false; Vector3 pos = wheelTransform.transform.localPosition; joint.connectedAnchor.Set(pos.x, pos.y, pos.z); }
public Truck(bool i_isCooled, float i_cargoVolume, VehicleInformation i_vehicleInformation, string i_wheelManufacturer) : base(i_vehicleInformation) { m_isCooled = i_isCooled; m_cargoVolume = i_cargoVolume; m_wheelInformation = new WheelInformation(28, 12, i_wheelManufacturer); base.WheelInformation = m_wheelInformation; }
public DifferntialWheelController(GameObject[] leftWheels, GameObject[] rightWheels, WheelInformation wheelConfigs) { if (leftWheels.Length != rightWheels.Length) { Debug.LogError("The number of left and right wheels must be the same!"); } this.leftWheels = leftWheels; this.rightWheels = rightWheels; this.wheelConfigs = wheelConfigs; }
void Awake() { if (leftWheels.Length != rightWheels.Length) { Debug.LogError("The number of left and right wheels must be the same!"); } wheelConfigs = new WheelInformation(); wheelConfigs.Mass = wheelMass; wheelConfigs.AirDrag = wheelAirDrag; wheelConfigs.RunDrag = wheelRunDrag; wheelConfigs.StopDrag = wheelStopDrag; wheelConfigs.MaxRotationSpeed = maxRotationSpeed; wheelConfigs.TorqueForceScale = torqueForceScale; wheelConfigs.Material = wheelMaterial; for (int i = 0; i < leftWheels.Length; i++) { setupWheel(leftWheels[i], body, wheelConfigs); setupWheel(rightWheels[i], body, wheelConfigs); } }
protected abstract void setupWheel(GameObject wheelTransform, Rigidbody handle, WheelInformation wheelConfigs);