Class OpenVRHandler
Handling OpenVR deivces.
處理 OpenVR 裝置。
Implements
Inherited Members
Namespace: Votanic.vIO.OpenVR
Assembly: Votanic.vIO.dll
Syntax
public class OpenVRHandler : Element, IDisposable
Constructors
OpenVRHandler(Single, Single, Single, Boolean)
Declare the OpenVR handler.
宣告 OpenVR 處理器。
Declaration
public OpenVRHandler(float axesDeadZone = 0.14F, float axesPressDetect = 0.7F, float holdingDuration = 1F, bool roleSystem = true)
Parameters
Type | Name | Description |
---|---|---|
System.Single | axesDeadZone | Dead zone of axes |
System.Single | axesPressDetect | Press detect value of axes |
System.Single | holdingDuration | Holding seconds of hold input type |
System.Boolean | roleSystem | Enable the role system |
Fields
lockPhysicsUpdateRateToRenderFrequency
Lock physics update rate to render frequency.
以渲染頻率鎖定物理更新速率。
Declaration
[Tooltip("Lock physics update rate to render frequency.\n以渲染頻率鎖定物理更新速率。")]
public bool lockPhysicsUpdateRateToRenderFrequency
Field Value
Type | Description |
---|---|
System.Boolean |
trackingSpace
Tracking space of OpenVR system.
OpenVR 系統的定位空間。
Declaration
[Tooltip("Tracking space of OpenVR system.\nOpenVR 系統的定位空間。")]
public ETrackingUniverseOrigin trackingSpace
Field Value
Type | Description |
---|---|
Votanic.vIO.OpenVR.ETrackingUniverseOrigin |
Properties
controllers
The OpenVR avaliable controllers.
可用的 OpenVR 控制器。
Declaration
public List<OpenVRDevice> controllers { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<OpenVRDevice> |
devices
The OpenVR devices scanned.
已掃瞄的 OpenVR 裝置。
Declaration
public List<OpenVRDevice> devices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<OpenVRDevice> |
needRefresh
The role system is needed to refresh if true.
當 true 時代表角色系統需要刷新。
Declaration
public bool needRefresh { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
refreshRate
Refresh rate for check the role system need to refresh or not.
檢查角色系統是否需要刷新的刷新率。
Declaration
public float refreshRate { get; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
AxisDown(Int32, AxisDirection, Int32, Boolean, AssistButtons)
Return true if an axis on controller is pressed (Absolute axis value >= Press detect value).
當控制器的軸按下時傳回 true(軸絕對值 >= 按下偵測值)。
AxisDown(0, AxisDirection.Positive, 0)
Declaration
public bool AxisDown(int index, AxisDirection direction = AxisDirection.Any, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Axis index |
AxisDirection | direction | The axis pressing direction |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse axis value if true |
AssistButtons | assistButtons | Assist buttons |
Returns
Type | Description |
---|---|
System.Boolean |
AxisHold(Int32, AxisDirection, Int32, Boolean, AssistButtons)
Return true if an axis on controller is held for a while (Absolute axis value >= Press detect value).
當控制器的軸長按一段時間時傳回 true(軸絕對值 >= 按下偵測值)。
AxisHold(0, AxisDirection.Positive, 0)
Declaration
public bool AxisHold(int index, AxisDirection direction = AxisDirection.Any, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Axis index |
AxisDirection | direction | The axis pressing direction |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse axis value if true |
AssistButtons | assistButtons | Assist buttons |
Returns
Type | Description |
---|---|
System.Boolean |
AxisPress(Int32, AxisDirection, Int32, Boolean, AssistButtons)
Return true if an axis on controller is pressing (Absolute axis value >= Press detect value).
當控制器的軸按住時傳回 true(軸絕對值 >= 按下偵測值)。
AxisPress(0, AxisDirection.Positive, 0)
Declaration
public bool AxisPress(int index, AxisDirection direction = AxisDirection.Any, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Axis index |
AxisDirection | direction | The axis pressing direction |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse axis value if true |
AssistButtons | assistButtons | Assist buttons |
Returns
Type | Description |
---|---|
System.Boolean |
AxisUp(Int32, AxisDirection, Int32, Boolean, AssistButtons)
Return true if an axis on controller is released (Absolute release value >= Press detect value).
當控制器的軸放開時傳回 true(釋放絕對值 >= 按下偵測值)。
AxisUp(0, AxisDirection.Positive, 0)
Declaration
public bool AxisUp(int index, AxisDirection direction = AxisDirection.Any, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Axis index |
AxisDirection | direction | The axis pressing direction |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse axis value if true |
AssistButtons | assistButtons | Assist buttons |
Returns
Type | Description |
---|---|
System.Boolean |
AxisValue(Int32, Int32, Boolean, AssistButtons)
Return the value of an axis on controller.
傳回控制器的一個軸的值。
AxisValue(0, 0)
Declaration
public float AxisValue(int index, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Axis index |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse axis value if true |
AssistButtons | assistButtons | Assist buttons |
Returns
Type | Description |
---|---|
System.Single |
ButtonDown(Int32, Int32, Boolean)
Return true if a button on controller is pressed.
當控制器的按鈕按下時傳回 true。
ButtonDown(0, 0)
Declaration
public bool ButtonDown(int index, int controller = 0, bool reversed = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Button index |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse the result if true |
Returns
Type | Description |
---|---|
System.Boolean |
ButtonHold(Int32, Int32, Boolean)
Return true if a button on controller is held for a while.
當控制器的按鈕長按一段時間時傳回 true。
ButtonHold(0, 0)
Declaration
public bool ButtonHold(int index, int controller = 0, bool reversed = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Button index |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse the result if true |
Returns
Type | Description |
---|---|
System.Boolean |
ButtonPress(Int32, Int32, Boolean)
Return true if a button on controller is pressing.
當控制器的按鈕按住時傳回 true。
ButtonPress(0, 0)
Declaration
public bool ButtonPress(int index, int controller = 0, bool reversed = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Button index |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse the result if true |
Returns
Type | Description |
---|---|
System.Boolean |
ButtonTouch(Int32, Int32, Boolean)
Return true if a button on controller is touched.
當控制器的按鈕被觸碰時傳回 true。
ButtonTouch(0, 0)
Declaration
public bool ButtonTouch(int index, int controller = 0, bool reversed = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Button index |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse the result if true |
Returns
Type | Description |
---|---|
System.Boolean |
ButtonUp(Int32, Int32, Boolean)
Return true if a button on controller is released.
當控制器的按鈕放開時傳回 true。
ButtonUp(0, 0)
Declaration
public bool ButtonUp(int index, int controller = 0, bool reversed = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Button index |
System.Int32 | controller | Controller index |
System.Boolean | reversed | Reverse the result if true |
Returns
Type | Description |
---|---|
System.Boolean |
Dispose()
Release OpenVR when stop application.
當停止應用程式時釋放 OpenVR。
Declaration
public void Dispose()
EnableRoleSystem()
Enable the role system.
啟動角色系統。
Declaration
public void EnableRoleSystem()
Finalize()
Declaration
protected void Finalize()
ScanDevice()
Scan OpenVR device on the system.
掃瞄系統中的 OpenVR 裝置。
Declaration
public void ScanDevice()
SetSkeleton(Transform, ETrackedControllerRole, EVRSkeletalMotionRange, EVRSkeletalReferencePose)
Bind the hand skeleton to role.
將手骨綁定於角色。
SetSkeleton(handTransform, ETrackedControllerRole.RightHand, EVRSkeletalMotionRange.WithoutController, EVRSkeletalReferencePose.OpenHand)
Declaration
public void SetSkeleton(Transform hand, ETrackedControllerRole role, EVRSkeletalMotionRange motionRange = EVRSkeletalMotionRange.WithoutController, EVRSkeletalReferencePose defaultPose = EVRSkeletalReferencePose.OpenHand)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | hand | Hand object |
Votanic.vIO.OpenVR.ETrackedControllerRole | role | Role |
Votanic.vIO.OpenVR.EVRSkeletalMotionRange | motionRange | Motion range |
Votanic.vIO.OpenVR.EVRSkeletalReferencePose | defaultPose | Default pose |
TrackerAccessible(String)
Return true if the tracker is accessible.
當定位器可讀取時傳回 true。
TrackerAccessible("Valve Controller")
Declaration
public bool TrackerAccessible(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Tracker name |
Returns
Type | Description |
---|---|
System.Boolean |
TrackerPosition(String)
Get the position of tracker in system.
取得系統中的定位器位置。
TrackerPosition("Valve Controller")
Declaration
public Vector3 TrackerPosition(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Tracker name |
Returns
Type | Description |
---|---|
UnityEngine.Vector3 |
TrackerRotation(String)
Get the rotation of tracker in system.
取得系統中的定位器角度。
TrackerRotation("Valve Controller")
Declaration
public Quaternion TrackerRotation(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Tracker name |
Returns
Type | Description |
---|---|
UnityEngine.Quaternion |
Update()
Update the current state of devices.
更新裝置目前狀態。
Declaration
public void Update()
Vibrate(UInt16, Int32)
Vibrate a controller.
使控制器震動。
Vibrate(1000, 0)
Declaration
public void Vibrate(ushort duration = 500, int controller = 0)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | duration | Vibrate micro seconds |
System.Int32 | controller | Controller index |