Vive Input Utility是一個能夠讓Htc Vive變得更容易開發的軟件,這個軟件的API參數不少開發者可能想知道,來這里看看吧。
API詳解:
uint ViveRole.GetDeviceIndex(DeviceRole role)
返回由role確定的設備的設備索引,如果role沒有分配任何設備的話返回OpenVR.k_unTrackedDeviceIndexInvalid。
bool VivePose.HasFocus()
返回true,如果當進程正在運行。通常當玩家按下手柄上菜單按鈕切換到steam菜單面板時,進程切換到后臺。
bool VivePose.IsConnected(DeviceRole role)
如果由role定義的設備被連接了返回true
bool VivePose.HasTracking(DeviceRole role)
如果由role定義的設備的追蹤數據有有效值的時候返回true
Pose VivePose.GetPose(DeviceRole role, Transform origin = null)
返回由role定義的設備的追蹤pose
void VivePose.SetPose(Transform target, DeviceRole role, Transform origin = null)
設置目標pose來追蹤由role定義的設備的相對于origin的pose
bool ViveInput.GetPress(HandRole role, ControllerButton button)
當控制器上的按鈕被按了的時候返回true
bool ViveInput.GetPressDown(HandRole role, ControllerButton button)
當控制器上的按鈕被按下的時候返回true
bool ViveInput.GetPressUp(HandRole role, ControllerButton button)
當控制器上的按鈕被松開的時候返回true
float ViveInput.GetTriggerValue(HandRole role)
返回扳機鍵的原始的模擬量
Vector2 ViveInput.GetPadAxis(HandRole role)
返回touchpad上的原始模擬量
int ViveInput.ClickCount(HandRole role, ControllerButton button)
返回按鈕連續點擊的次數。查看ViveInput.clickInterval來獲取點擊間隔時間
float ViveInput.LastPressDownTime(HandRole role, ControllerButton button)
返回用戶按下按鈕的最后一幀的時間
void ViveInput.AddPress(HandRole role, ControllerButton button, Action callback)
void ViveInput.AddPressDown(HandRole role, ControllerButton button, Action callback)
void ViveInput.AddPressUp(HandRole role, ControllerButton button, Action callback)
void ViveInput.AddClick(HandRole role, ControllerButton button, Action callback)
void ViveInput.RemovePress(HandRole role, ControllerButton button, Action callback)
void ViveInput.RemovePressDown(HandRole role, ControllerButton button, Action callback)
void ViveInput.RemovePressUp(HandRole role, ControllerButton button, Action callback)
void ViveInput.RemoveClick(HandRole role, ControllerButton button, Action callback)
添加和移除press、pressdown、pressup、click的監聽事件
void ViveInput.TriggerHapticPulse(HandRole role, ushort intensity = 500)
控制器上扳機的震動。