Example #1
0
    // Token: 0x06004F1C RID: 20252 RVA: 0x001AA760 File Offset: 0x001A8B60
    private void UpdateTracking()
    {
        this.leftHandGrasper.longReachMode  = false;
        this.rightHandGrasper.longReachMode = false;
        bool flag  = this.isGrasping(false);
        bool flag2 = this.isGrasping(true);

        if (flag || flag2 || VRCTrackingManager.IsPlayerNearTracking())
        {
            this.UpdateEffectorPositions();
            this.SetHandGraspersNearTracking(flag, flag2);
            if (VRCTrackingManager.IsTracked(VRCTracking.ID.Hmd))
            {
                PoseRecorder.poseContents |= 32;
            }
            this.headPosWeight = 1f;
            this.headRotWeight = 1f;
            if (this._useVrcTrackedIk && this.vrcTrackedIk.hasLowerBodyTracking && this.vrcTrackedIk.isCalibrated)
            {
                if (VRCTrackingManager.IsTracked(VRCTracking.ID.BodyTracker_Hip))
                {
                    PoseRecorder.poseContents |= 64;
                }
                if (VRCTrackingManager.IsTracked(VRCTracking.ID.FootTracker_LeftFoot))
                {
                    PoseRecorder.poseContents |= 128;
                }
                if (VRCTrackingManager.IsTracked(VRCTracking.ID.FootTracker_RightFoot))
                {
                    PoseRecorder.poseContents |= 256;
                }
            }
            float   trackingScale = VRCTrackingManager.GetTrackingScale();
            Vector3 position      = this.HeadEffector.transform.position;
            if (this.motion.IsSeated || this.motion.IsImmobilized)
            {
                position = this._modelAnimator.GetBoneTransform(HumanBodyBones.Head).position;
            }
            if (VRCTrackingManager.IsTracked(VRCTracking.ID.HandTracker_LeftWrist) || flag)
            {
                Transform transform = this.LeftEffector.transform;
                float     num       = Vector3.Distance(position, transform.position) / trackingScale;
                this.leftWeight            = Mathf.Clamp01(7f - num * 7f);
                PoseRecorder.poseContents |= 4;
            }
            else
            {
                this.leftWeight = 0f;
            }
            if (VRCTrackingManager.IsTracked(VRCTracking.ID.HandTracker_RightWrist) || flag2)
            {
                Transform transform2 = this.RightEffector.transform;
                float     num2       = Vector3.Distance(position, transform2.position) / trackingScale;
                this.rightWeight           = Mathf.Clamp01(7f - num2 * 7f);
                PoseRecorder.poseContents |= 8;
            }
            else
            {
                this.rightWeight = 0f;
            }
        }
        else
        {
            this.SetHandGraspersNearTracking(false, false);
            if (this._modelAnimator != null && this._modelAnimator.isHuman)
            {
                float trackingScale2 = VRCTrackingManager.GetTrackingScale();
                if (VRCTrackingManager.IsPlayerNearTracking())
                {
                    PoseRecorder.poseContents |= 32;
                    this.headPosWeight         = 1f;
                    this.headRotWeight         = 1f;
                }
                if (this.leftHandGrasper.IsHoldingObject())
                {
                    Transform  boneTransform = this._modelAnimator.GetBoneTransform(HumanBodyBones.LeftHand);
                    Quaternion tposeRotation = this.animationController.GetTPoseRotation(HumanBodyBones.LeftHand);
                    Quaternion rhs           = Quaternion.Inverse(tposeRotation) * Quaternion.AngleAxis(180f, Vector3.forward);
                    this.LeftEffector.transform.rotation = boneTransform.rotation * rhs;
                    Vector3 b = boneTransform.rotation * rhs * (this.EffectorWristOffset / trackingScale2);
                    this.LeftEffector.transform.position = boneTransform.position + b;
                    PoseRecorder.poseContents           |= 4;
                    this.leftWeight = 1f;
                }
                if (this.rightHandGrasper.IsHoldingObject())
                {
                    Transform  boneTransform2 = this._modelAnimator.GetBoneTransform(HumanBodyBones.RightHand);
                    Quaternion tposeRotation2 = this.animationController.GetTPoseRotation(HumanBodyBones.RightHand);
                    Quaternion rhs2           = Quaternion.Inverse(tposeRotation2);
                    this.RightEffector.transform.rotation = boneTransform2.rotation * rhs2;
                    Vector3 b2 = boneTransform2.rotation * rhs2 * (this.EffectorWristOffset / trackingScale2);
                    this.RightEffector.transform.position = boneTransform2.position + b2;
                    PoseRecorder.poseContents            |= 8;
                    this.rightWeight = 1f;
                }
            }
        }
    }
Example #2
0
 // Token: 0x060056C6 RID: 22214 RVA: 0x001DD9E8 File Offset: 0x001DBDE8
 public static bool AreHandsTracked()
 {
     return(VRCTrackingManager.IsTracked(VRCTracking.ID.HandTracker_LeftWrist) && VRCTrackingManager.IsTracked(VRCTracking.ID.HandTracker_RightWrist));
 }
Example #3
0
    // Token: 0x060062B2 RID: 25266 RVA: 0x00232DD8 File Offset: 0x002311D8
    private void Update()
    {
        if (!VRCTrackingManager.IsInitialized())
        {
            return;
        }
        this.UpdateWindowsCursorLock();
        this.UpdateActiveCursorSet();
        bool flag  = (this.inDropLeft.button && VRCInputManager.legacyGrasp) || this.forcedCursor == VRCUiCursor.CursorHandedness.Left;
        bool flag2 = (this.inDropRight.button && VRCInputManager.legacyGrasp) || this.forcedCursor == VRCUiCursor.CursorHandedness.Right;
        bool flag3 = this.inDropRight.button || this.forcedCursor == VRCUiCursor.CursorHandedness.Right;
        bool flag4 = this.inDropRight.button || this.forcedCursor == VRCUiCursor.CursorHandedness.Right;

        this.leftTarget.Reset();
        this.rightTarget.Reset();
        if (this.activeCursor == VRCUiCursorManager.CursorType.Hands)
        {
            if (this.inUseLeft.down || this.inDropLeft.down)
            {
                this.dominantHand = VRCUiCursor.CursorHandedness.Left;
            }
            else if (this.inUseRight.down || this.inDropRight.down)
            {
                this.dominantHand = VRCUiCursor.CursorHandedness.Right;
            }
            bool active = VRCTrackingManager.IsTracked(VRCTracking.ID.HandTracker_LeftPointer) && (this.uiActive || flag) && !this.blockLeftCursor;
            this.handLeftCursor.gameObject.SetActive(active);
            this.handLeftCursor.UpdateCursor(this.leftTarget, this.dominantHand == VRCUiCursor.CursorHandedness.Left);
            bool active2 = VRCTrackingManager.IsTracked(VRCTracking.ID.HandTracker_RightPointer) && (this.uiActive || flag2) && !this.blockRightCursor;
            this.handRightCursor.gameObject.SetActive(active2);
            this.handRightCursor.UpdateCursor(this.rightTarget, this.dominantHand == VRCUiCursor.CursorHandedness.Right);
            bool flag5 = VRCTrackingManager.IsTracked(VRCTracking.ID.HandTracker_LeftPointer) && LocomotionInputController.navigationCursorActive && !this.uiActive && VRCInputManager.locomotionMethod == VRCInputManager.LocomotionMethod.ThirdPerson;
            this.navigationCursor.gameObject.SetActive(flag5);
            if (flag5)
            {
                this.navigationCursor.UpdateCursor(null, true);
            }
            this.gazeCursor.gameObject.SetActive(false);
            this.mouseCursor.gameObject.SetActive(false);
        }
        else if (this.activeCursor == VRCUiCursorManager.CursorType.Gaze)
        {
            bool active3 = this.uiActive || flag4;
            this.gazeCursor.gameObject.SetActive(active3);
            this.gazeCursor.UpdateCursor(this.rightTarget, true);
            this.dominantHand = VRCUiCursor.CursorHandedness.Right;
            this.handLeftCursor.gameObject.SetActive(false);
            this.handRightCursor.gameObject.SetActive(false);
            this.navigationCursor.gameObject.SetActive(false);
            this.mouseCursor.gameObject.SetActive(false);
        }
        else if (this.activeCursor == VRCUiCursorManager.CursorType.Mouse)
        {
            bool active4 = this.uiActive || flag3;
            this.mouseCursor.gameObject.SetActive(active4);
            this.mouseCursor.UpdateCursor(this.rightTarget, true);
            this.dominantHand = VRCUiCursor.CursorHandedness.Right;
            this.handLeftCursor.gameObject.SetActive(false);
            this.handRightCursor.gameObject.SetActive(false);
            this.navigationCursor.gameObject.SetActive(false);
            this.gazeCursor.gameObject.SetActive(false);
        }
    }