getTrackState

Admin
Site Admin
Posts: 13
Joined: Mon Jul 04, 2016 5:42 pm

getTrackState

Postby Admin » Mon Jul 04, 2016 10:11 pm

Function getTrackState:

parameters:
none

returns:
array of 4 floats
[0] - values greater than 0 means that controller device was captured by the camera on last frame.
[1] - x position (horizontal) of tracked device, in range [-0.5,0.5].
[2] - y position (vertical) of tracked device, in range [-0.5,0.5].
[3] - z position (forward) of tracked device, in range [0,1], where 1 is farthest.


description:
Gets unaltered tracking information. In most cases getAcceleratedTrackState function should be used, unless you would like to write your own motion prediction algorithm.

when should be used:
every time you need current tracked device position

typical usage example (Unity):

Code: Select all

Vector3 maxPos;
//Get top right corner of player camera in 3D space
maxPos=Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth,Camera.main.pixelHeight,0.6f));
//Get inverse transform for this point to get bounds for virtual object position on screen.
maxPos=Camera.main.transform.InverseTransformPoint(maxPos);
maxPos*=2;

float[] data;
data=pluginObject.Call<float[]>("getTrackState");
currGunPos=new Vector3( (data[1])*maxPos.x, (data[2])*maxPos.y, 0.3f+0.3f*data[3]);

Return to “RevolVR SDK API”

Who is online

Users browsing this forum: No registered users and 1 guest