Пример #1
0
    private void UpdateFoveInterfaceMatrices(bool immediate)
    {
        var t = fove.transform;

        if (immediate)
        {
            // In the case of 120 FPS recording rate, we re-fetch the HMD latest pose
            // and localy recalculate the fove interface local transform
            var pose                = FoveManager.GetHMDPose(true);
            var isStanding          = fove.poseType == FoveInterface.PlayerPose.Standing;
            var hmdAdjustedPosition = (isStanding ? pose.standingPosition : pose.position).ToVector3();
            var localPos            = fove.fetchPosition? hmdAdjustedPosition : t.position;
            var localRot            = fove.fetchOrientation? pose.orientation.ToQuaternion() : t.rotation;

            var parentTransfo = t.parent != null ? t.parent.localToWorldMatrix : Matrix4x4.identity;
            var localTransfo  = Matrix4x4.TRS(localPos, localRot, t.localScale);

            lock (foveInterfaceTransfo)
            {
                foveInterfaceTransfo.HMDToWorld = parentTransfo * localTransfo;
                foveInterfaceTransfo.HMDToLocal = localTransfo;
            }
        }
        else
        {
            // no need to lock the object, we are in synchronize mode (access from the same thread)
            foveInterfaceTransfo.HMDToWorld = t.localToWorldMatrix;
            foveInterfaceTransfo.HMDToLocal = Matrix4x4.TRS(t.localPosition, t.localRotation, t.localScale);
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        var pose     = FoveManager.GetHMDPose();
        var conv     = FoveManager.GetHMDGazeConvergence();
        var foveConv = fove.GetGazeConvergence();

        ManagerOrientText.text   = toFomattedString(pose.orientation.ToQuaternion());
        ManagerPosText.text      = toFomattedString(pose.position.ToVector3());
        ManagerGazeText.text     = toFomattedString(conv.ray.direction);
        InterfaceOrientText.text = toFomattedString(fove.transform.rotation);
        InterfacePosText.text    = toFomattedString(fove.transform.position);
        InterfaceGazeText.text   = toFomattedString(foveConv.ray.direction);
    }