コード例 #1
0
    // Token: 0x06005790 RID: 22416 RVA: 0x001E32FC File Offset: 0x001E16FC
    private void CheckSafetyBubble()
    {
        if (this.currentAvatar == null || this.currentAvatarDescriptor == null)
        {
            return;
        }
        if (this._avatarPedestal != null)
        {
            return;
        }
        if (this._vrcPlayer == null)
        {
            return;
        }
        if (!VRCInputManager.personalSpace)
        {
            this.SetIsInsidePersonalSpace(false);
            return;
        }
        if (APIUser.IsFriendsWith(this._vrcPlayer.player.userId))
        {
            this.SetIsInsidePersonalSpace(false);
            return;
        }
        float   y              = this.currentAvatarDescriptor.ViewPosition.y;
        float   num            = Mathf.Lerp(this.MinBubbleRadius, this.MaxBubbleRadius, Mathf.InverseLerp(2f, 4f, y));
        float   capsuleHeight  = y + num * 2f;
        Vector3 capsuleCenter  = new Vector3(0f, y / 2f, 0f);
        Vector3 worldCameraPos = VRCVrCamera.GetInstance().GetWorldCameraPos();
        bool    flag           = false;

        PhysicsUtil.ClosestPointOnCapsule(base.transform.localToWorldMatrix, capsuleCenter, capsuleHeight, num, 1, worldCameraPos, ref flag);
        bool flag2 = false;

        if (flag)
        {
            this.SetIsInsidePersonalSpace(true);
            flag2 = true;
        }
        else
        {
            Animator component = this.currentAvatar.GetComponent <Animator>();
            if (component != null && component.isHuman)
            {
                Transform boneTransform = component.GetBoneTransform(HumanBodyBones.LeftHand);
                if (boneTransform != null && Vector3.SqrMagnitude(boneTransform.position - worldCameraPos) <= this.HandBubbleRadius * this.HandBubbleRadius)
                {
                    this.SetIsInsidePersonalSpace(true);
                    flag2 = true;
                }
                if (!flag2)
                {
                    Transform boneTransform2 = component.GetBoneTransform(HumanBodyBones.RightHand);
                    if (boneTransform2 != null && Vector3.SqrMagnitude(boneTransform2.position - worldCameraPos) <= this.HandBubbleRadius * this.HandBubbleRadius)
                    {
                        this.SetIsInsidePersonalSpace(true);
                        flag2 = true;
                    }
                }
            }
        }
        if (!flag2)
        {
            this.SetIsInsidePersonalSpace(false);
        }
    }
コード例 #2
0
 // Token: 0x06005393 RID: 21395 RVA: 0x001CD6E9 File Offset: 0x001CBAE9
 public static Vector3 ClosestPointOnCollider(CapsuleCollider col, Vector3 pt, ref bool isPointInside)
 {
     return(PhysicsUtil.ClosestPointOnCapsule(col.transform.localToWorldMatrix, col.center, col.height, col.radius, col.direction, pt, ref isPointInside));
 }