Managed CSharp APIs - VRTRIX/VRTRIXGlove_Unity3D_SDK GitHub Wiki

Managed CSharp APIs

Here is a list of all documented namespaces with brief descriptions:

VRTRIX

VRTRIXDataWrapper

bool Init(HANDTYPE type)

Initialize a hand object with corresponding hand type.

Parameters

  • type: HANDTYPE enum indicate left/right hand attribute.

Return

  • true if corresponded hand is initialized successfully.

void MarshalUnmananagedArray2Struct<VRTRIX_Quat>(IntPtr unmanagedArray, int length, out VRTRIX_Quat[] mangagedArray)

Marshal an unmanaged array read from low-level APIs to a customized struct VRTRIX_Quat

Parameters

  • unmanagedArray: The unmanaged array from unmanaged C++ API.
  • length: The length of the unmanaged & managed array.
  • mangagedArray: The output managed array contains several VRTRIX_Quat.

void receivedData(HANDTYPE type)

Receive data from unmanaged C++ API through delegate method with corresponding hand type.

Parameters

  • type: HANDTYPE enum indicate left/right hand attribute.

Quaternion GetReceivedRotation(VRTRIXBones bone)

Get received rotation data according to index of hand bones.

Parameters

  • bone: Index of hand bones.

Return

  • Rotation in Quaternion implementation of corresponding hand bones.

float GetReceivedGestureAngle (VRTRIXBones bone)

Get received gesture angle to recognize gestures according to index of hand bones.

Parameters

  • bone: Index of hand bones.

Return

  • The angle between the back of hand and corresponding finger bones.

int GetReceivedDataRate()

Get received data rate per second.

Return

  • Number of data packets received successfully by Unity3D engine.

bool DataValidStatus (VRTRIXBones bone)

Get received data valid status according to index of hand bones. Data may be tagged as invalid if strong magnetic distortion is detected or the data wireless transmission is corrupted.

Parameters

  • bone: Index of hand bones.

Return

  • Data valid status according to index of hand bones.

VRTRIXGloveStatus GetReceivedStatus()

Get received glove status, including CLOSED, NORMAL,PAUSED,MAGANOMALY.

Return

  • Current glove status.

bool sendData(string s)

Send certain string to hardware through Serial Ports.

Parameters

  • s: Certain string to be sent through serial ports.

Return

  • true if the transmission is successful.

bool calibration()

Save the background-calibration-parameters to hardware's flash, used only when doing the open-box calibration.

Return

  • true if the calibration parameters are saved to hardware successfully.
bool vibrate()

Send the haptic feedback signal to hardware.

Return

  • true if haptic feedback signal is sent successfully.

void alignmentCheck(HANDTYPE type)

Align all fingers orientation to the back of hand. Note that it is a software-orientation reset, and it won't affect the hardware.

Parameters

  • type: HANDTYPE enum indicate left/right hand attribute.

VRTRIXGloveVRInteraction

void SetRotation(VRTRIXBones bone, Quaternion rotation, bool valid, HANDTYPE type)

Apply quaternion data received from wrapper class to bone's rotation.

Parameters

  • bone: Index of hand bones.
  • valid: Data valid status according to index of hand bones.
  • type: HANDTYPE enum indicate left/right hand attribute.

void SetPosition(VRTRIXBones bone, Vector3 pos, Quaternion rot, Vector3 offset)

Apply position data received to bone's location.

Parameters

  • bone: Index of hand bones.
  • pos: 3D position received from the wrist tracker.
  • rot: Current rotation of bone with corresponding index.
  • offset: Wrist position refine coefficient, used to calibrate the offset between the position of tracker & wrist.

Quaternion GetOffset(GameObject tracker, VRTRIXDataWrapper glove, HANDTYPE type)

Get the yaw offset between magnetic North and lighthouse tracking orientation reference.

Parameters

  • tracker: Tracker object with corresponding hand type.
  • glove: Glove data streaming object.
  • type: HANDTYPE enum indicate left/right hand attribute.

Return

  • Yaw offset in quaternion implementation

VRTRIXGloveGesture GetGesture (HANDTYPE type)

Get real time gesture type of corresponding hand.

Parameters

  • type: HANDTYPE enum indicate left/right hand attribute.

Return

  • VRTRIXGloveGesture enum indicate the gesture type of hand.

GameObject CheckDeviceModelName(HANDTYPE type = HANDTYPE.NONE, InteractiveDevice device = InteractiveDevice.NONE)

Get the right gameobject in the tracked objects list that correspond to certain device index. Parameters

  • type (Optional): HANDTYPE enum indicate left/right hand attribute.
  • device (Optional): InteractiveDevice enum indicate which kind of VRTRIX hardware it belongs

Return

  • The gameobject in the tracked objects list that correspond to certain device index.

VRTRIXGloveGrab

void AttachObject(GameObject objectToAttach, AttachmentFlags flags = defaultAttachmentFlags, string attachmentPoint = "")

Attach a GameObject to this GameObject.

Parameters

  • objectToAttach : The GameObject to attach.
  • flags (Optional): The attach modes to use for attaching the object.
  • attachmentPoint (Optional): Name of the GameObject in the hierarchy of this Hand which should act as the attachment point for this GameObject.

void DetachObject(GameObject objectToDetach, bool restoreOriginalParent = true)

Detach a GameObject from this GameObject.

Parameters

  • objectToDetach : The GameObject to detach from this Hand
  • restoreOriginalParent (Optional): Whether to restore original parent after detachment.

Transform GetAttachmentTransform(string attachmentPoint = "")

Get the transform of object which should be attached when grabbing if the attachment point is not specified.

Parameters

  • attachmentPoint : Specified attachment point.

Return

  • The transform of object which should be attached.

bool GetStandardInteractionButton()

Get the status of grab hand gesture.

Return

  • true if your hand is in grabbing gesture.

bool GetPressButtonDown()

Get the status of touch hand gesture.

Return

  • true if your hand is in touch gesture.

bool GetTeleportButton()()

Get the status of teleport hand gesture.

Return

  • true if your hand is in teleport gesture.

VRTRIXGloveHoverEvents

public UnityEvent onHandHoverBegin;
public UnityEvent onHandHoverEnd;
public UnityEvent onAttachedToHand;
public UnityEvent onDetachedFromHand;

Handler when hand hover begin, hover end, attached object to hand and detached from hand.

VRTRIXVelocityEstimator

void BeginEstimatingVelocity()

Begin velocity estimation when throwing object.

void FinishEstimatingVelocity()

Finish velocity estimation when throwing object.

Vector3 GetVelocityEstimate()

Get estimated velocity.

Return

  • Estimated velocity in Vector3.

Vector3 GetAngularVelocityEstimate()

Get estimated angular velocity.

Return

  • Estimated angular velocity in Vector3.

Vector3 GetAccelerationEstimate()

Get estimated acceleration.

Return

  • Estimated acceleration in Vector3.

VRTRIXGloveButtons

void ResetScene()

Reset the example scene, move all objects to original location.

void Vibrate(VRTRIXGloveGrab hand)

Vibrate the corresponded hand which touched the button.

Parameters

  • hand : Specified hand object.

void HideLogo()

Hide logo in demo scene.

void ShowLogo()

Show logo in demo scene.

VRTRIXGloveGestureRecognition

VRTRIXGloveGesture GestureDetection(VRTRIXDataWrapper hand, HANDTYPE type)

Get current gesture of specified hand and hand type.

Parameters

  • hand : Specified hand object.
  • type: HANDTYPE enum indicate left/right hand attribute.

Return

  • Gesture enum, including BUTTONCLICK, BUTTONOK, BUTTONGRAB, BUTTONTELEPORT by default.

VRTRIXUtilities

string GetBoneName(int id)

Get hand bone name according to its bone index. Parameters

  • id : Bone Index.

Return

  • Hand bone name.

int GetBoneIndex(string name)

Get hand bone index according to its bone name.

Parameters

  • name : Bone name.

Return

  • Hand bone index.

enums

enum VRTRIXGloveRunningMode
enum VRTRIXBones
enum VRTRIXGloveGesture
enum HANDTYPE
enum VRTRIXGloveStatus
enum InteractiveDevice