SteamVR_Controller.Device.GetAxis C# (CSharp) Méthode

GetAxis() public méthode

public GetAxis ( EVRButtonId buttonId = EVRButtonId.k_EButton_SteamVR_Touchpad ) : Vector2
buttonId EVRButtonId
Résultat Vector2
        public Vector2 GetAxis(EVRButtonId buttonId = EVRButtonId.k_EButton_SteamVR_Touchpad)
        {
            Update();
            var axisId = (uint)buttonId - (uint)EVRButtonId.k_EButton_Axis0;
            return new Vector2(state.rAxis[axisId].x, state.rAxis[axisId].y);
        }

Usage Example

Exemple #1
0
    void Update()
    {
        //Set device equal to the tracked controller
        device = SteamVR_Controller.Input((int)trackedObject.index);
        //Store touchpad y axis in local variable
        touchpadY = device.GetAxis().y;
        touchpadX = device.GetAxis().x;

        if (isNoCollison)
        {
            //If touchpad is touched in top half
            movePlayer();
        }
        else
        {
            if (touchpadY < 0)               //Player can only move backwards
            {
                movePlayer();
            }
            else
            {
                Debug.Log("STILL STUCK");
            }
        }
    }
All Usage Examples Of SteamVR_Controller.Device::GetAxis