示例#1
0
    // Token: 0x06005004 RID: 20484 RVA: 0x001B5638 File Offset: 0x001B3A38
    public void Finalize(Animator animator, VRC_AvatarDescriptor Ad, bool local)
    {
        VRC_AnimationController component = base.GetComponent <VRC_AnimationController>();

        component.Reset(animator, Ad);
        if (animator.isHuman)
        {
            if (this.avatarManager != null && this.player != null)
            {
                this.Push(this.avatarManager.GetStandAnimController());
                if (this.avatarAnimation != null && this.avatarAnimation.motionState.IsSeated && this.player.currentStation != null)
                {
                    this.player.currentStation.ApplySeatedAnimation(this.player);
                }
                component.GenerateLocalHandCollision();
            }
            else
            {
                this.Push(animator.runtimeAnimatorController);
            }
        }
        else
        {
            this.Push(animator.runtimeAnimatorController);
        }
    }
示例#2
0
    // Token: 0x06005003 RID: 20483 RVA: 0x001B5544 File Offset: 0x001B3944
    public void Initialize(Animator animator, VRC_AvatarDescriptor Ad, bool local)
    {
        VRC_AnimationController component = base.GetComponent <VRC_AnimationController>();

        this.avatarManager            = base.transform.parent.GetComponentInChildren <VRCAvatarManager>();
        this.avatarAnimation          = base.GetComponent <AvatarAnimation>();
        this.player                   = base.transform.parent.GetComponent <VRC.Player>();
        this.mInitialized             = true;
        this.mAvatarAnimator          = animator;
        this.mAnimatorControllerStack = new List <RuntimeAnimatorController>();
        if (animator.isHuman)
        {
            this.Push(this.tPoseController);
            animator.updateMode  = AnimatorUpdateMode.UnscaledTime;
            animator.cullingMode = AnimatorCullingMode.AlwaysAnimate;
            animator.Update(0.01f);
            animator.transform.localPosition = Vector3.zero;
            animator.transform.localRotation = Quaternion.identity;
            if (component != null)
            {
                component.RecordTPose(animator);
            }
            this.avatarManager.MeasureHumanAvatar(animator);
            animator.updateMode = AnimatorUpdateMode.Normal;
            if (!local)
            {
                animator.cullingMode = AnimatorCullingMode.CullUpdateTransforms;
            }
        }
        this.Finalize(animator, Ad, local);
    }
示例#3
0
    // Token: 0x0600577A RID: 22394 RVA: 0x001E20CC File Offset: 0x001E04CC
    public void MeasureHumanAvatar(Animator A)
    {
        this.headTransform = A.GetBoneTransform(HumanBodyBones.Head);
        Transform transform = base.transform;

        A.transform.localPosition = Vector3.zero;
        transform.localPosition   = Vector3.zero;
        VRC_AnimationController vrc_AnimationController = null;

        if (this._vrcPlayer != null)
        {
            vrc_AnimationController = this._vrcPlayer.GetComponentInChildren <VRC_AnimationController>();
        }
        float     a              = 0f;
        float     b              = 0f;
        Transform boneTransform  = A.GetBoneTransform(HumanBodyBones.LeftHand);
        Transform boneTransform2 = A.GetBoneTransform(HumanBodyBones.RightHand);

        if (boneTransform)
        {
            a = (this.headTransform.position - boneTransform.position).magnitude;
        }
        if (boneTransform2)
        {
            b = (this.headTransform.position - boneTransform2.position).magnitude;
        }
        float num = Mathf.Max(a, b);

        if (num > 0f)
        {
            this.currentAvatarArmLength = num;
        }
        else
        {
            this.currentAvatarArmLength = VRCTracking.DefaultArmLength;
        }
        Vector3 viewPosition = this.currentAvatarDescriptor.ViewPosition;

        this.currentAvatarEyeHeight = viewPosition.y;
        Vector3 headToViewPointOffset = viewPosition - transform.InverseTransformPoint(this.headTransform.position);

        headToViewPointOffset.z = -headToViewPointOffset.z;
        if (this.localPlayer)
        {
            VRCTrackingManager.SetAvatarViewPoint(viewPosition, headToViewPointOffset);
        }
        this.headScale = this.headTransform.localScale;
        GameObject gameObject = new GameObject("HmdPivot");

        gameObject.transform.position = transform.TransformPoint(new Vector3(viewPosition.x, viewPosition.y, viewPosition.z));
        gameObject.transform.SetParent(this.headTransform, true);
        gameObject.transform.rotation = transform.rotation;
        if (vrc_AnimationController != null)
        {
            this.maxHeadRadius = 0.5f * this.currentAvatarArmLength / VRCTracking.DefaultArmLength;
            IkController component = vrc_AnimationController.HeadAndHandsIkController.GetComponent <IkController>();
            component.InitHeadEffector(A, this.localPlayer);
        }
        this.WasMeasured = true;
        if (this.localPlayer)
        {
            VRCTrackingManager.AdjustViewPositionToAvatar();
            Vector3 neckToEyeOffset = base.transform.InverseTransformVector(gameObject.transform.position - this.headTransform.position);
            VRCVrCamera.GetInstance().SetNeckToEyeOffset(neckToEyeOffset);
        }
    }