/// <summary> /// Checks if a button is down /// </summary> /// <param name="button"></param> /// <param name="id"></param> /// <returns></returns> public bool GetDown(sl.CONTROLS_BUTTON button, int id = -1) { #if ZED_OCULUS return(OVRInput.GetDown(ConvertToButton(button))); #else return(false); #endif }
/// <summary> /// Checks if button is down /// </summary> /// <param name="idButton"></param> /// <param name="idPad"></param> /// <returns></returns> public bool GetDown(sl.CONTROLS_BUTTON idButton, int idPad) { #if ZED_STEAM_VR if (!padsAreInit || idPad == -1) { return(false); } return(SteamVR_Controller.Input(idPad).GetPressDown(ConvertToButton(idButton))); #else return(false); #endif }
/// <summary> /// Converts a button to a SteamVR enum /// </summary> /// <param name="button"></param> /// <returns></returns> private EVRButtonId ConvertToButton(sl.CONTROLS_BUTTON button) { switch (button) { case sl.CONTROLS_BUTTON.ONE: return(model == HMD.OCULUS ? EVRButtonId.k_EButton_A : EVRButtonId.k_EButton_ApplicationMenu); case sl.CONTROLS_BUTTON.THREE: return(EVRButtonId.k_EButton_ApplicationMenu); case sl.CONTROLS_BUTTON.PRIMARY_THUBMSTICK: return(EVRButtonId.k_EButton_SteamVR_Touchpad); case sl.CONTROLS_BUTTON.SECONDARY_THUMBSTICK: return(EVRButtonId.k_EButton_SteamVR_Touchpad); } return(EVRButtonId.k_EButton_ApplicationMenu); }
/// <summary> /// Converts the standard ID button to the ID of Oculus /// </summary> /// <param name="button"></param> /// <returns></returns> private OVRInput.Button ConvertToButton(sl.CONTROLS_BUTTON button) { switch (button) { case sl.CONTROLS_BUTTON.ONE: return(OVRInput.Button.One); case sl.CONTROLS_BUTTON.THREE: return(OVRInput.Button.Three); case sl.CONTROLS_BUTTON.PRIMARY_THUBMSTICK: return(OVRInput.Button.PrimaryThumbstick); case sl.CONTROLS_BUTTON.SECONDARY_THUMBSTICK: return(OVRInput.Button.SecondaryThumbstick); } return(OVRInput.Button.None); }