// Update the _rotation Quaternion for use by any object that wants to reference the calibrated orientation of the controller in application space.
    private void SetRotationQuaternion()
    {
        double[] tOrientation = _controllerPlugin.GetOrientationScaled();
        _oriVector.Set((float)-tOrientation[0], (float)-tOrientation[1], (float)tOrientation[2]);

        float w = _oriVector.magnitude;

        // Store local orientation for use when setting offset
        _controllerPoseInSensorSpace = Quaternion.AngleAxis(w * Mathf.Rad2Deg, _oriVector);

        // Apply calibrated offset
        _rotation = _handheldControllerOrientationOffset * _controllerPoseInSensorSpace;
    }