void InitTracker() { pose = GetPose(); Lzwp.debug.Log("GameObject '{0}' is tracking pose {1}", gameObject.name, pose.name); TrackingStateChanged(pose.tracked); Lzwp.input.PosesUpdated += UpdatePose; pose.OnTrackingStateChanged += TrackingStateChanged; }
void UpdateViewRotation() { LzwpPose rotationPivotPose = null; Vector3 oldPivotPointPosition = Vector3.zero; if (Lzwp.initialized) { rotationPivotPose = Lzwp.display.pointsOfView[0].targetPose; oldPivotPointPosition = rotationPivotPose.position; } Quaternion targetRotation = Quaternion.AngleAxis(rotationY, Vector3.up) * Quaternion.AngleAxis(rotationX, Vector3.right); transform.localRotation = Quaternion.Slerp(transform.localRotation, targetRotation, config.general.rotationSmoothSpeed * Time.deltaTime); if (Lzwp.initialized) { transform.position += oldPivotPointPosition - rotationPivotPose.position; } }