private void PredictAccleration() { _possibleFastAccel = true; // get in default state _carAngle = Vehicle.Rotation.X; // Check if any wheel is not on allowed surface foreach (var wheelPos in _wheelPos) { var surface = World.Raycast(wheelPos, wheelPos + new Vector3(0, 0, -10), IntersectFlags.Everything, Vehicle); if (!_allowedSurfaces.Contains(surface.MaterialHash)) { _possibleFastAccel = false; } } // Check if car angle is too high or not on all wheels if (_possibleFastAccel) { if (_carAngle > 7 || !Vehicle.IsOnAllWheels || Utils.IsAnyTireBurst(Vehicle)) { _possibleFastAccel = false; } } // Check for player bursting car tires if (VehicleControl.GetWheelRotationSpeeds(Vehicle)[0] < 1f) { // Check if car is on same place if (Speed < 1) { _wheelPosPrev = _wheelPos; _isPosChanged = false; } if (_wheelPosPrev != null) { foreach (var pos in _wheelPos) { if (pos.Round(1) != _wheelPosPrev[ _wheelPos.IndexOf(pos)].Round(1)) { _isPosChanged = true; break; } } } if (_isPosChanged && _possibleFastAccel) { _possibleFastAccel = false; } } }
private void GetAccelerationSound() { WheelSpeed = VehicleControl.GetWheelRotationSpeeds(Vehicle)[3]; // Define engine sound variation based on wheel speed _currentAccel = _engineAccell1Sound; if (CurrentGear == 2) { _currentAccel = _engineAccell2Sound; } if (CurrentGear == 3) { _currentAccel = _engineAccell3Sound; } if (CurrentGear >= 4) { _currentAccel = _engineAccell4Sound; } }