Example #1
0
    // Token: 0x060056AF RID: 22191 RVA: 0x001DD208 File Offset: 0x001DB608
    public static float GetPlayerSeatedPlayAdjustment(bool recalibrate = false)
    {
        float       x           = VRCTrackingManager.instance.transform.localScale.x;
        float       num         = VRCTracking.DefaultSeatedEye;
        VRCVrCamera vrcvrCamera = VRCVrCamera.GetInstance();
        VRCPlayer   vrcplayer   = VRCPlayer.Instance;

        if (!VRCTrackingManager._usingStationViewPoint && recalibrate && vrcvrCamera != null && vrcplayer != null)
        {
            num  = vrcplayer.transform.InverseTransformPoint(vrcvrCamera.GetWorldCameraPos()).y / x;
            num -= vrcvrCamera.GetLiftAmount();
            VRCTrackingManager.instance.seatedEyePosition = num;
        }
        else
        {
            num = VRCTrackingManager.instance.seatedEyePosition;
        }
        return(VRCTrackingManager.GetAvatarViewPoint().y * 0.96f / x - num);
    }
Example #2
0
    // Token: 0x060056B7 RID: 22199 RVA: 0x001DD434 File Offset: 0x001DB834
    private static IEnumerator UseAvatarStationViewPointCoroutine(bool isInStation)
    {
        VRCPlayer player           = VRCPlayer.Instance;
        bool      alreadyInStation = VRCTrackingManager._usingStationViewPoint;

        if (isInStation)
        {
            VRCVrCamera vrcam     = VRCVrCamera.GetInstance();
            float       eyeHeight = VRCTrackingManager.GetAvatarEyeHeight();
            if (player != null)
            {
                if (vrcam != null)
                {
                    eyeHeight = player.transform.InverseTransformPoint(VRCVrCamera.GetInstance().GetWorldCameraPos()).y;
                }
                if (VRCTrackingManager.instance.avatarMgr != null && VRCTrackingManager.instance.animatorControllerMgr != null && VRCTrackingManager.instance.animatorControllerMgr.avatarAnimator != null)
                {
                    if (VRCTrackingManager.instance.ik != null)
                    {
                        VRCTrackingManager.instance.ik.SeatedChange(true);
                        yield return(null);

                        VRCTrackingManager.instance.ik.SeatedChange(true);
                        yield return(null);

                        VRCTrackingManager.instance.ik.SeatedChange(true);
                        yield return(null);

                        VRCTrackingManager.instance.ik.SeatedChange(true);
                        yield return(null);
                    }
                    Transform headTransform = VRCTrackingManager.instance.animatorControllerMgr.avatarAnimator.GetBoneTransform(HumanBodyBones.Head);
                    if (headTransform != null && player != null)
                    {
                        Transform transform = headTransform.Find("HmdPivot");
                        VRCTrackingManager._avatarStationViewPoint = player.transform.InverseTransformPoint(transform.position);
                    }
                    if (VRCTrackingManager.instance.ik != null)
                    {
                        VRCTrackingManager.instance.ik.enabled = true;
                    }
                }
            }
            VRCTrackingManager._usingStationViewPoint = true;
            if (VRCTrackingManager.instance.cameraMount != null)
            {
                VRCTrackingManager.instance.cameraMount.localPosition = new Vector3(0f, VRCTrackingManager._avatarStationViewPoint.y, 0f);
            }
            float scale = VRCTrackingManager.instance.transform.localScale.x;
            float lift  = 0f;
            if (vrcam != null)
            {
                lift = vrcam.GetLiftAmount();
            }
            VRCTrackingManager.OffsetCameraForHeight(scale, eyeHeight / scale - lift, !alreadyInStation);
        }
        else
        {
            VRCTrackingManager._usingStationViewPoint = false;
            if (VRCTrackingManager.instance.cameraMount != null)
            {
                VRCTrackingManager.instance.cameraMount.localPosition = new Vector3(0f, VRCTrackingManager._avatarViewPoint.y, 0f);
            }
            float x = VRCTrackingManager.instance.transform.localScale.x;
            VRCTrackingManager.OffsetCameraForHeight(x, VRCTrackingManager.playerEyeHeight, true);
        }
        yield break;
    }