Пример #1
0
    //...use this one
    private void FixedUpdate()
    {
        if (engine_on)
        {
            CheckSpeedChange();

            //hover off ground
            DoHover();

            //forward/backward
            ApplyThrust();

            //ascend up and down
            ModifyHoverHeight(ascend_amount);
            //set angle
            DoTiltAngle(ascend_amount);

            Rotate();

            car_rb.transform.eulerAngles = new Vector3(current_tilt, car_rb.transform.rotation.eulerAngles.y, current_rotate);
        }

        //turn left and right
        car_rb.AddRelativeTorque(0f, HoverControlScheme.InputStateToInt(controls.turn_input) * turn_speed, 0f);

        DoAngularVelocityBreak();
    }
Пример #2
0
 private void ApplyThrust()
 {
     if (driverActions.Accelerate.IsPressed)
     {
         car_rb.AddRelativeForce(0f, 0f, GetSpeedModifier() * HoverControlScheme.InputStateToInt(controls.power_input) * thruster_speed);
     }
     else if (driverActions.Reverse.IsPressed)
     {
         car_rb.AddRelativeForce(0f, 0f, GetSpeedModifier() * HoverControlScheme.InputStateToInt(controls.power_input) * reverse_speed);
     }
 }
Пример #3
0
 private void Awake()
 {
     car_rb   = GetComponent <Rigidbody>();
     controls = GetComponent <HoverControlScheme>();
     DoControlBindings();
 }
Пример #4
0
 private void Awake()
 {
     controls = GetComponent <HoverControlScheme>();
 }