Exemplo n.º 1
0
        // Component methods


        void OnEnable()
        {
            if (vehicle != null)
            {
                m_input    = vehicle.GetComponent <VPStandardInput>();
                m_settings = vehicle.GetComponent <VPSettingsSwitcher>();
            }
            else
            {
                m_input    = null;
                m_settings = null;
            }

            if (drivingAidsPanel != null)
            {
                drivingAidsPanel.ConfigureDefaults();
                drivingAidsPanel.gameObject.SetActive(false);
            }

            // Switching steering mode when no gyro is available is not handled properly.
            // It may take a bit to the filter to catch up with the current acceleration.
            //
            // TO-DO: This should be deprecated and use a n-averaged value instead.

            m_acceleration = Input.acceleration;

            // Fallback to regular touch mode if no accelerometer nor gyro are present

            if (!SystemInfo.supportsAccelerometer && !SystemInfo.supportsGyroscope)
            {
                steeringMode = SteeringMode.Touch;
            }
        }
Exemplo n.º 2
0
 public SafetyModule(IDataSource dataSource, IMapProvider mapProvider, IPathProvider pathProvider,
                     VPVehicleController carController, VPStandardInput input)
 {
     DataSource    = dataSource;
     _mapProvider  = mapProvider;
     _pathProvider = pathProvider;
     CarController = carController;
     Input         = input;
     dataSource.DetectedObstacles += (sender, obstacles) => OnDataFusionArrive(obstacles);
 }
Exemplo n.º 3
0
 public static void ReleaseBrake(this VPStandardInput input)
 {
     input.externalBrake  = 0;
     input.externalClutch = 0;
 }
Exemplo n.º 4
0
 public override void OnEnableVehicle()
 {
     m_vehicle = vehicle.GetComponent <VPVehicleController>();
     m_input   = vehicle.GetComponent <VPStandardInput>();
 }
Exemplo n.º 5
0
 public static void StopACar(this VPStandardInput input, VPVehicleController carController)
 {
     //TODO zrobić płynne hamowanie przez użycie PIDA
     input.externalBrake  = carController.brakes.maxBrakeTorque;
     input.externalClutch = 1;
 }