EasyManua.ls Logo

HTC Vive Tracker - Page 34

HTC Vive Tracker
47 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Vive Tracker
Developer Guidelines
HTC Corporation 07/17/2017
V
er.
1.5
31
HTC Confidential and Proprietary
The following is a Unity sample code:
Figure: Unity sample code for accessory integration (1)
public class Accessory : MonoBehaviour {
const float dX = 0.0100224f;
const float dY = -0.07616526f;
const float dZ = 0.4884118f;
const float roll = 10.854305f;
const float yaw = 91.8736f;
const float pitch = 78.805113f;
void Update () {
//Collect delta rotation and displacement between Tracker and Accessory
Vector3 delta_displacement = new Vector3(dX, dY, dZ);
Quaternion delta_rotation = Quaternion.Euler(roll, yaw, pitch);
//Get current Tracker pose
Vector3 tracker_position = SteamVR_Controller.Input(3).transform.pos;
Quaternion tracker_rotation = SteamVR_Controller.Input(3).transform.rot;
//Transform current Tracker pose to Accessory pose
GameObject.Find("Accessory ").transform.rotation = tracker_rotation * delta_rotation;
GameObject.Find("Accessory ").transform.position = tracker_position + (tracker_rotation *
delta_rotation) * delta_displacement;
}
}

Other manuals for HTC Vive Tracker

Related product manuals