Ejemplo n.º 1
0
    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;
    }
Ejemplo n.º 2
0
    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;
        }
    }