HTC Vive Tracker Developer Manuallines page 34

Hide thumbs Also See for Vive Tracker:
Table of Contents

Advertisement

The following is a Unity sample code:
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
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;
}
}
Vive Tracker
HTC Corporation
= SteamVR_Controller.Input(3).transform.pos;
Figure: Unity sample code for accessory integration (1)
Developer Guidelines
07/17/2017
Ver. 1.5
31
HTC Confidential and Proprietary

Advertisement

Table of Contents
loading

Table of Contents