/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { pizarooView = new PizarooView(Content, GraphicsDevice); //screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; //screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; screenWidth = 1250; screenHeight = 1600; graphics.PreferredBackBufferWidth = screenWidth; graphics.PreferredBackBufferHeight = screenHeight; graphics.ApplyChanges(); //create game objects int vehicleX = 75; // Player initial position int vehicleY = screenHeight - 220; // Vehicle position on the vertical axis playerVehicle = new PlayerVehicle(vehicleX, vehicleY, screenWidth, pizarooView); // create the player playerMovedInfo += playerVehicle.PlayerMovedListener; vehicle1 = new AIVehicle(25, 10, screenWidth, pizarooView, 1); vehicle2 = new AIVehicle(275, 400, screenWidth, pizarooView, 2); vehicle3 = new AIVehicle(540, 800, screenWidth, pizarooView, 3); vehicle4 = new AIVehicle(775, 1200, screenWidth, pizarooView, 2); vehicle5 = new AIVehicle(1025, 10, screenWidth, pizarooView, 1); }
// Update is called once per frame void Update() { if (Input.GetKey("h")) { RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit, 8.0f)) { Transform other = hit.collider.transform; while (other.parent != null) { other = other.parent; } if (other.name == "AIVehicle") { target = other.GetComponent <AIVehicle>(); target.moveAside = true; } } else { if (target != null) { target.moveAside = false; } } } else { if (target != null) { target.moveAside = false; } } }
//////////////////////////////////////////////////////////// public void ShowVehicleUI() { AIVehicleComponent = AIContoller.manager.vehicleCamera.target.GetComponent <AIVehicle>(); if (!panels.tachometer.activeSelf) { panels.tachometer.SetActive(true); } gearst = AIVehicleComponent.currentGear; vehicleUI.speedText.text = ((int)AIVehicleComponent.vehicleSpeed).ToString(); if (AIVehicleComponent.automaticGear) { if (gearst > 0 && AIVehicleComponent.vehicleSpeed > 1) { vehicleUI.gearText.color = Color.green; vehicleUI.gearText.text = gearst.ToString(); } else if (AIVehicleComponent.vehicleSpeed > 1) { vehicleUI.gearText.color = Color.red; vehicleUI.gearText.text = "R"; } else { vehicleUI.gearText.color = Color.white; vehicleUI.gearText.text = "N"; } } else { if (AIVehicleComponent.neutralGear) { vehicleUI.gearText.color = Color.white; vehicleUI.gearText.text = "N"; } else { if (AIVehicleComponent.currentGear != 0) { vehicleUI.gearText.color = Color.green; vehicleUI.gearText.text = gearst.ToString(); } else { vehicleUI.gearText.color = Color.red; vehicleUI.gearText.text = "R"; } } } thisAngle = (AIVehicleComponent.motorRPM / 20) - 175; thisAngle = Mathf.Clamp(thisAngle, -180, 90); vehicleUI.tachometerNeedle.rectTransform.rotation = Quaternion.Euler(0, 0, -thisAngle); vehicleUI.barShiftGUI.rectTransform.localScale = new Vector3(AIVehicleComponent.powerShift / 100.0f, 1, 1); }
public void DrawVehicle(int move, IVehicle vehicle) { if (vehicle is AIVehicle) { AIVehicle v = (AIVehicle)vehicle; v.MoveVehicle(move); } spriteBatch.Draw(vehicle.imgVehicle, new Vector2(vehicle.X, vehicle.Y), null, Microsoft.Xna.Framework.Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Awake() { AIVehicle = transform.GetComponent <AIVehicle>(); if (carParticles.brakeParticleMaterial) { carParticles.brakeParticlePerfab.GetComponent <ParticleSystemRenderer>().material = carParticles.brakeParticleMaterial; } if (carSetting.automaticGear) { NeutralGear = false; } myRigidbody = transform.GetComponent <Rigidbody>(); wheels = new WheelComponent[4]; wheels[0] = SetWheelComponent(carWheels.wheels.frontRight, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontRight.position.y); wheels[1] = SetWheelComponent(carWheels.wheels.frontLeft, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontLeft.position.y); wheels[2] = SetWheelComponent(carWheels.wheels.backRight, 0, carWheels.wheels.backWheelDrive, carWheels.wheels.backRight.position.y); wheels[3] = SetWheelComponent(carWheels.wheels.backLeft, 0, carWheels.wheels.backWheelDrive, carWheels.wheels.backLeft.position.y); if (carSetting.carSteer) { steerCurAngle = carSetting.carSteer.localEulerAngles; } foreach (WheelComponent w in wheels) { WheelCollider col = w.collider; col.suspensionDistance = carWheels.setting.Distance; JointSpring js = col.suspensionSpring; js.spring = carSetting.springs; js.damper = carSetting.dampers; col.suspensionSpring = js; col.radius = carWheels.setting.Radius; col.mass = carWheels.setting.Weight; WheelFrictionCurve fc = col.forwardFriction; fc.asymptoteValue = 5000.0f; fc.extremumSlip = 2.0f; fc.asymptoteSlip = 20.0f; fc.stiffness = carSetting.stiffness; col.forwardFriction = fc; fc = col.sidewaysFriction; fc.asymptoteValue = 7500.0f; fc.asymptoteSlip = 2.0f; fc.stiffness = carSetting.stiffness; col.sidewaysFriction = fc; } }
public override void Update(GameTime gameTime) { if (FireCoolDownCouter >= FireCoolDownTime) { FireCoolDownCouter = 0; AIVehicle.Fire(); } FireCoolDownCouter += (float)gameTime.ElapsedGameTime.TotalSeconds; base.Update(gameTime); }
public static void BuildTrain(TileIndex depot, StationID[] stations, Action <TileIndex, string> sign = null) { var list = new AIEngineList(AIVehicle.VT_RAIL); list.Valuate(AIEngine.GetMaxSpeed); EngineID passangerWagon = null; EngineID mailWagon = null; foreach (var(a, b) in list) { if (AIEngine.IsBuildable(a) && !AIEngine.IsWagon(a)) { //AILog.Info(a + ": " + AIEngine.GetName(a) + " | " + AIEngine.GetMaxSpeed(a) + " | " + AIEngine.GetReliability(a) + " | " + AIEngine.GetMaxTractiveEffort(a)); } else if (AIEngine.IsBuildable(a) && AIEngine.IsWagon(a)) { //AILog.Info(a + ": " + AIEngine.GetName(a) + " | " + AIEngine.GetCargoType(a)); if (AICargo.HasCargoClass(AIEngine.GetCargoType(a), AICargo.CC_PASSENGERS)) { passangerWagon = a; //AILog.Info("passanger"); } else if (AICargo.HasCargoClass(AIEngine.GetCargoType(a), AICargo.CC_MAIL)) { mailWagon = a; //AILog.Info("mail"); } } } var engineType = list.Begin(); //AILog.Info("Engine id: " + engineType); //AILog.Info("Building: " + AIEngine.GetName(engineType)); var train = AIVehicle.BuildVehicle(depot, engineType); var firstPassanger = AIVehicle.BuildVehicle(depot, passangerWagon); AIVehicle.BuildVehicle(depot, passangerWagon); AIVehicle.BuildVehicle(depot, passangerWagon); var firstMail = AIVehicle.BuildVehicle(depot, mailWagon); AIVehicle.MoveWagonChain(firstMail, 0, train, 0); AIVehicle.MoveWagonChain(firstPassanger, 0, train, 0); for (var i = 0; i < stations.Length; i++) { AIOrder.AppendOrder(train, AIStation.GetLocation(stations[i]), AIOrder.OF_NONE); } AIVehicle.StartStopVehicle(train); }
void OnTriggerStay(Collider other) { if (other.CompareTag("HandleTrigger")) { GameControl.manager.getInVehicle.SetActive(true); if ((GameControl.manager.controlMode == ControlMode.simple && Input.GetKey(KeyCode.F)) || (GameControl.manager.controlMode == ControlMode.touch && GameControl.driving == true)) { if (other.transform.root.GetComponent <CarComponents>()) { carComponents = other.transform.root.GetComponent <CarComponents>(); m_AIVehicle = other.transform.root.GetComponent <AIVehicle>(); m_VehicleControl = other.transform.root.GetComponent <VehicleControl>(); door = carComponents.door; handleTrigger = carComponents.handleTrigger; sitPoint = carComponents.sitPoint; gettingOnCar = true; gettingOnBike = false; GameControl.manager.getInVehicle.SetActive(false); } if (other.transform.root.GetComponent <BikeComponents>()) { bikeComponents = other.transform.root.GetComponent <BikeComponents>(); m_AIVehicle = other.transform.root.GetComponent <AIVehicle>(); m_BikeControl = other.transform.root.GetComponent <BikeControl>(); handleTrigger = bikeComponents.handleTrigger; sitPoint = bikeComponents.sitPoint; gettingOnBike = true; gettingOnCar = false; GameControl.manager.getInVehicle.SetActive(false); } } } }
internal bool MakeRoute(TownNode fromTown, TownNode toTown) { AILog.Warning($"Building a route from {fromTown.Name} to {toTown.Name}."); RoadStationInfo fromStationTile = stations[fromTown.TownId]; RoadStationInfo toStationTile = stations[toTown.TownId]; Edge <TownNode> foundEdge = null; foreach (var edge in this.Graph.Edges) { if (((edge.Node1 == fromTown) && (edge.Node2 == toTown)) || ((edge.Node2 == fromTown) && (edge.Node1 == toTown))) { foundEdge = edge; } } if (foundEdge == null) { AILog.Warning($"No route found from {fromTown.Name} to {toTown.Name}."); return(false); } var list = new AIEngineList(AIVehicle.VT_ROAD); list.Valuate(AIEngine.GetMaxSpeed); VehicleID vehicleId = null; foreach (var(engineType, _) in list) { if (AICargo.HasCargoClass(AIEngine.GetCargoType(engineType), AICargo.CC_PASSENGERS)) { var price = AIEngine.GetPrice(engineType); CsTestAi.EnsureMoney(price + 1000); vehicleId = AIVehicle.BuildVehicle(depots[fromTown.TownId].tile, engineType); break; } } if (vehicleId == null) { AILog.Error("No passnger vehicle found."); } if (AIVehicle.IsValidVehicle(vehicleId)) { AIOrder.AppendOrder(vehicleId, fromStationTile.tile, AIOrder.OF_NONE); AIOrder.AppendOrder(vehicleId, toStationTile.tile, AIOrder.OF_NONE); AIVehicle.StartStopVehicle(vehicleId); if (!vehicles.ContainsKey(foundEdge)) { vehicles.Add(foundEdge, new List <VehicleID>()); } var vehicleList = vehicles[foundEdge]; vehicleList.Add(vehicleId); AILog.Info($"Route contains now {vehicleList.Count} vehicles."); return(true); } AILog.Error("Invalid vehicle."); return(false); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Awake() { if (bikeSetting.automaticGear) { NeutralGear = false; } AIVScript = transform.GetComponent <AIVehicle>(); if (bikeSounds.horn) { AIVScript.horn = bikeSounds.horn; } if (AIVScript.vehicleStatus == VehicleStatus.EmptyOff) { bikeOff = true; foreach (Light brakeLight in bikeLights.brakeLights) { brakeLight.enabled = false; } } else { bikeOff = false; } myRigidbody = transform.GetComponent <Rigidbody>(); SteerRotation = bikeSetting.bikeSteer.localRotation; wheels = new WheelComponent[2]; wheels[0] = SetWheelComponent(bikeWheels.wheels.wheelFront, bikeWheels.wheels.AxleFront, false, bikeSetting.maxSteerAngle, bikeWheels.wheels.AxleFront.localPosition.y); wheels[1] = SetWheelComponent(bikeWheels.wheels.wheelBack, bikeWheels.wheels.AxleBack, true, 0, bikeWheels.wheels.AxleBack.localPosition.y); wheels[0].collider.transform.localPosition = new Vector3(0, wheels[0].collider.transform.localPosition.y, wheels[0].collider.transform.localPosition.z); wheels[1].collider.transform.localPosition = new Vector3(0, wheels[1].collider.transform.localPosition.y, wheels[1].collider.transform.localPosition.z); foreach (WheelComponent w in wheels) { WheelCollider col = w.collider; col.suspensionDistance = bikeWheels.setting.Distance; JointSpring js = col.suspensionSpring; js.spring = bikeSetting.springs; js.damper = bikeSetting.dampers; col.suspensionSpring = js; col.radius = bikeWheels.setting.Radius; col.mass = bikeWheels.setting.Weight; WheelFrictionCurve fc = col.forwardFriction; fc.asymptoteValue = 0.5f; fc.extremumSlip = 0.4f; fc.asymptoteSlip = 0.8f; fc.stiffness = bikeSetting.stiffness; col.forwardFriction = fc; fc = col.sidewaysFriction; fc.asymptoteValue = 0.75f; fc.extremumSlip = 0.2f; fc.asymptoteSlip = 0.5f; fc.stiffness = bikeSetting.stiffness; col.sidewaysFriction = fc; } }
void Update() { StartingGameTimer(); ShowCarUI(); if (sceneLoadingOperation != null) { panels.gameStart.loadingBar.fillAmount = Mathf.MoveTowards(panels.gameStart.loadingBar.fillAmount, sceneLoadingOperation.progress + 0.2f, Time.deltaTime * 0.5f); if (panels.gameStart.loadingBar.fillAmount > sceneLoadingOperation.progress) { sceneLoadingOperation.allowSceneActivation = true; } } if (carPenalty) { penaltyTime += Time.deltaTime; panels.gamePlay.penaltyText.color = Color.red; } else { panels.gamePlay.penaltyText.color = Color.white; } if (carWrongWay) { panels.gamePlay.wrongWay.gameObject.SetActive(true); } else { panels.gamePlay.wrongWay.gameObject.SetActive(false); } if (carBrakeWarning) { panels.gamePlay.brakeWarning.color = new Color(1, 1, 1, 1); } else { panels.gamePlay.brakeWarning.color = new Color(1, 1, 1, 0.2f); } panels.gamePlay.currentTime.text = "Time: " + FormatSeconds(AIControl.CurrentVehicle.AIVehicle.playerCurrentTime); panels.gamePlay.bestTime.text = "Best: " + FormatSeconds(PlayerPrefs.GetFloat("BestTime" + Application.loadedLevel)); panels.gamePlay.penaltyText.text = "Penalty: " + FormatSeconds(penaltyTime).ToString(); panels.gamePlay.driftCoins.text = "Drift Coins: " + totalDriftCoins.ToString(); if (!gameFinished && !carWrongWay) { if (timerDrift == 0) { canDrift = true; } else { timerDrift = Mathf.MoveTowards(timerDrift, 0.0f, Time.deltaTime); } if ((driftAmount / 100.0f) > 1.0f) { timerDrift = 1.0f; earnCoins = (driftAmount - 100); panels.gamePlay.driftWheel.fillAmount = 1.0f; panels.gamePlay.driftWheel.rectTransform.Rotate(0, 0, -500.0f * Time.deltaTime); panels.gamePlay.driftText.text = (driftAmount - 100).ToString(); panels.gamePlay.driftXText.gameObject.SetActive(true); if (earnCoins > 300) { if (panels.gamePlay.driftXText.text == "2X") { panels.gamePlay.driftXText.GetComponent <Animator>().Play(0); panels.gamePlay.driftXText.text = "3X"; } totalEarnCoins = earnCoins * 3; } else if (earnCoins > 150) { if (panels.gamePlay.driftXText.text == "1X") { panels.gamePlay.driftXText.GetComponent <Animator>().Play(0); panels.gamePlay.driftXText.text = "2X"; } totalEarnCoins = earnCoins * 2; } else if (earnCoins > 0) { panels.gamePlay.driftXText.text = "1X"; totalEarnCoins = earnCoins; } } else if (canDrift) { if (panels.gamePlay.driftWheel.fillAmount == 1) { totalDriftCoins += totalEarnCoins; totalEarnCoins = 0; earnCoins = 0; } panels.gamePlay.driftWheel.fillAmount = driftAmount / 100.0f; panels.gamePlay.driftWheel.rectTransform.rotation = Quaternion.identity; panels.gamePlay.driftText.text = ""; panels.gamePlay.driftXText.gameObject.SetActive(false); } } else { driftAmount = 0; panels.gamePlay.driftWheel.fillAmount = 0.0f; panels.gamePlay.driftWheel.rectTransform.rotation = Quaternion.identity; panels.gamePlay.driftText.text = ""; panels.gamePlay.driftXText.gameObject.SetActive(false); if (gameFinished) { if (panels.gameFinish.root.activeSelf == false) { AIVehicleScript = AIControl.CurrentVehicle.AIVehicle; panels.gameFinish.yourTime.text = "Current: " + FormatSeconds(AIVehicleScript.playerBestTime); panels.gameFinish.penaltyTime.text = "Penalty: " + FormatSeconds(penaltyTime); if (AIVehicleScript.playerBestTime < PlayerPrefs.GetFloat("BestTime" + Application.loadedLevel) || PlayerPrefs.GetFloat("BestTime" + Application.loadedLevel) == 0) { PlayerPrefs.SetFloat("BestTime" + Application.loadedLevel, AIVehicleScript.playerBestTime); panels.gameFinish.bestTime.text = "Best: " + FormatSeconds(AIVehicleScript.playerBestTime); } else { panels.gameFinish.bestTime.text = "Best: " + FormatSeconds(PlayerPrefs.GetFloat("BestTime" + Application.loadedLevel)); } if (AIVehicleScript.playerBestTime < (panels.gameFinish.stars.Star3Time - penaltyTime)) { panels.gameFinish.stars.Star1.color = Color.white; panels.gameFinish.stars.Star2.color = Color.white; panels.gameFinish.stars.Star3.color = Color.white; racePrize = (int)((Application.loadedLevel / 5.0f) * 3000.0f); PlayerPrefs.SetInt("LevelStar" + Application.loadedLevel, 3); } else if (AIVehicleScript.playerBestTime < (panels.gameFinish.stars.Star2Time - penaltyTime)) { panels.gameFinish.stars.Star1.color = Color.white; panels.gameFinish.stars.Star2.color = Color.white; racePrize = (int)((Application.loadedLevel / 5.0f) * 2000.0f); PlayerPrefs.SetInt("LevelStar" + Application.loadedLevel, 2); } else if (AIVehicleScript.playerBestTime < (panels.gameFinish.stars.Star1Time - penaltyTime)) { panels.gameFinish.stars.Star1.color = Color.white; racePrize = (int)((Application.loadedLevel / 5.0f) * 1500.0f); PlayerPrefs.SetInt("LevelStar" + Application.loadedLevel, 1); } else { PlayerPrefs.SetInt("LevelStar" + Application.loadedLevel, 0); racePrize = (int)((Application.loadedLevel / 5.0f) * 1000.0f); } totalPrize = (totalDriftCoins + racePrize); panels.gameFinish.racePrize.text = "Track: " + racePrize.ToString(); panels.gameFinish.driftPrize.text = "Drift Coins: " + totalDriftCoins.ToString(); panels.gameFinish.totalPrize.text = "Total: " + totalPrize.ToString(); panels.gamePlay.root.gameObject.SetActive(false); panels.gamePuased.root.gameObject.SetActive(false); panels.gameFinish.root.gameObject.SetActive(true); PlayerPrefs.SetInt("GameScore", PlayerPrefs.GetInt("GameScore") + totalPrize); if (PlayerPrefs.GetInt("CurrentLevelUnlocked") <= Application.loadedLevel) { PlayerPrefs.SetInt("CurrentLevelUnlocked", Application.loadedLevel); } } } } }
public void InstantiateVehicle(Node CurrentNode) { Collider[] vehicles = Physics.OverlapSphere(CurrentNode.transform.position, offsetDistance); bool CanCreateVehicle = true; foreach (Collider vehicle in vehicles) { if (vehicle.CompareTag("Vehicle")) { CanCreateVehicle = false; } } AIVehicle = AIContoller.manager.vehiclesPrefabs[Random.Range(0, AIContoller.manager.vehiclesPrefabs.Length)]; if (AIVehicle) { if (CanCreateVehicle && AIContoller.manager.currentVehicles < AIContoller.manager.maxVehicles) { RaycastHit hit; if (Physics.Raycast(CurrentNode.transform.position, -Vector3.up, out hit)) { AIContoller.manager.currentVehicles++; ///AiVehicleCreated = Instantiate(AIVehicle, hit.point + (Vector3.up / 2.0f), Quaternion.identity) as GameObject; AiVehicleCreated = Lean.Pool.LeanPool.Spawn(AIVehicle, hit.point + (Vector3.up / 2.0f), Quaternion.identity) as GameObject; } AiVehicleCreated.name = "AIVehicle"; if (AiVehicleCreated.GetComponent <AIVehicle>()) { AIVehicle AIVehicleScript = AiVehicleCreated.GetComponent <AIVehicle>(); if (CurrentNode.mode == "TwoWay") { randomWay = Random.Range(1, 3); if (randomWay == 1) { AIVehicleScript.wayMove = WayMove.Left; AIVehicleScript.myStatue = "NextPoint"; AiVehicleCreated.transform.LookAt(CurrentNode.previousNode); AIVehicleScript.currentNode = CurrentNode.transform; AIVehicleScript.nextNode = CurrentNode.nextNode; AiVehicleCreated.transform.position = AiVehicleCreated.transform.TransformPoint(CurrentNode.widthDistance, 0, 0); } else { AIVehicleScript.wayMove = WayMove.Right; AIVehicleScript.myStatue = "PreviousPoint"; AiVehicleCreated.transform.LookAt(CurrentNode.nextNode); AIVehicleScript.currentNode = CurrentNode.transform; AIVehicleScript.nextNode = CurrentNode.previousNode; AiVehicleCreated.transform.position = AiVehicleCreated.transform.TransformPoint(CurrentNode.widthDistance, 0, 0); } } else { AIVehicleScript.wayMove = WayMove.Right; AIVehicleScript.myStatue = "PreviousPoint"; AiVehicleCreated.transform.LookAt(CurrentNode.nextNode); AIVehicleScript.currentNode = CurrentNode.transform; AIVehicleScript.nextNode = CurrentNode.nextNode; AiVehicleCreated.transform.position = AiVehicleCreated.transform.TransformPoint(Random.Range(-CurrentNode.widthDistance, CurrentNode.widthDistance) / 2.0f, 0, 0); } } } } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Awake() { AIVScript = transform.GetComponent <AIVehicle>(); myRigidbody = transform.GetComponent <Rigidbody>(); if (carSounds.horn) { AIVScript.horn = carSounds.horn; } if (AIVScript.vehicleStatus == VehicleStatus.EmptyOff) { carOff = true; foreach (Light brakeLight in carLights.brakeLights) { brakeLight.enabled = false; } foreach (Light WLight in carLights.reverseLights) { WLight.enabled = false; } } else { carOff = false; } if (carSetting.automaticGear) { NeutralGear = false; } wheels = new WheelComponent[4]; wheels[0] = SetWheelComponent(carWheels.wheels.frontRight, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontRight.position.y); wheels[1] = SetWheelComponent(carWheels.wheels.frontLeft, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontLeft.position.y); wheels[2] = SetWheelComponent(carWheels.wheels.backRight, 0, carWheels.wheels.backWheelDrive, carWheels.wheels.backRight.position.y); wheels[3] = SetWheelComponent(carWheels.wheels.backLeft, 0, carWheels.wheels.backWheelDrive, carWheels.wheels.backLeft.position.y); if (carSetting.carSteer) { steerCurAngle = carSetting.carSteer.localEulerAngles; } foreach (WheelComponent w in wheels) { WheelCollider col = w.collider; col.suspensionDistance = carWheels.setting.Distance; JointSpring js = col.suspensionSpring; js.spring = carSetting.springs; js.damper = carSetting.dampers; col.suspensionSpring = js; col.radius = carWheels.setting.Radius; col.mass = carWheels.setting.Weight; WheelFrictionCurve fc = col.forwardFriction; fc.asymptoteValue = 5000.0f; fc.extremumSlip = 2.0f; fc.asymptoteSlip = 20.0f; fc.stiffness = carSetting.stiffness; col.forwardFriction = fc; fc = col.sidewaysFriction; fc.asymptoteValue = 7500.0f; fc.asymptoteSlip = 2.0f; fc.stiffness = carSetting.stiffness; col.sidewaysFriction = fc; } }