private Vector2 GetAxis(Passer.VRControllerState_t state, Passer.EVRButtonId button) { var axisId = (uint)button - (uint)Passer.EVRButtonId.k_EButton_Axis0; switch (axisId) { case 0: return(new Vector2(state.rAxis0.x, state.rAxis0.y)); case 1: return(new Vector2(state.rAxis1.x, state.rAxis1.y)); case 2: return(new Vector2(state.rAxis2.x, state.rAxis2.y)); case 3: return(new Vector2(state.rAxis3.x, state.rAxis3.y)); case 4: return(new Vector2(state.rAxis4.x, state.rAxis4.y)); } return(Vector2.zero); }
private float GetAxisX(Passer.VRControllerState_t state, Passer.EVRButtonId button) { var axisId = (uint)button - (uint)Passer.EVRButtonId.k_EButton_Axis0; switch (axisId) { case 0: return(state.rAxis0.x); case 1: return(state.rAxis1.x); case 2: return(state.rAxis2.x); case 3: return(state.rAxis3.x); case 4: return(state.rAxis4.x); } return(0); }
private ulong ButtonMaskFromId(Passer.EVRButtonId id) { return((ulong)1 << (int)id); }
private bool GetTouch(Passer.VRControllerState_t controllerState, Passer.EVRButtonId button) { return((controllerState.ulButtonTouched & ButtonMaskFromId(button)) != 0); }