Ejemplo n.º 1
0
    public void Update()
    {
        if (ThrusterController != null)
        {
            var rotationAxis = Vector3.zero;

            switch (Axis)
            {
            case RotationAxis.TopDown: rotationAxis = Vector3.up;      break;

            case RotationAxis.Right:   rotationAxis = Vector3.right;   break;

            case RotationAxis.Up:      rotationAxis = Vector3.up;      break;

            case RotationAxis.Front:   rotationAxis = Vector3.forward; break;
            }

            // You must call this before applying a new burn
            ThrusterController.ResetAllThrusters();

            // Move Forwards/Backwards
            ThrusterController.ThrusterLinearBurn(Vector3.forward, Input.GetAxis("Vertical"), Space.Self);

            // Move Right/Left
            //ThrusterController.ThrusterLinearBurn(Vector3.right, Input.GetAxis("Some Other Axis"), Space.Self);

            // Rotate Right/Left
            ThrusterController.ThrusterAngularBurn(rotationAxis, Input.GetAxis("Horizontal"), Space.Self);
        }
    }