示例#1
0
 // Token: 0x06004F18 RID: 20248 RVA: 0x001AA474 File Offset: 0x001A8874
 private void SetIkType(IkController.IkType iktype, bool reinit = false)
 {
     if (iktype == IkController.IkType.SixPoint)
     {
         this._currentIkType   = iktype;
         this.vrcTrackedIk     = base.GetComponent <VRCFbbIkController>();
         this._useVrcTrackedIk = true;
         this._useLimbIK       = false;
     }
     else if (iktype == IkController.IkType.ThreeOrFourPoint)
     {
         this._currentIkType   = iktype;
         this.vrcTrackedIk     = base.GetComponent <VRCVrIkController>();
         this._useVrcTrackedIk = true;
         this._useLimbIK       = false;
     }
     else if (iktype == IkController.IkType.Limb)
     {
         this._currentIkType   = iktype;
         this._useLimbIK       = true;
         this._useVrcTrackedIk = false;
         this.vrcTrackedIk     = null;
         this.limbik           = this._modelAnimator.GetComponent <LimbIK>();
         if (this._ikHeadBone != null)
         {
             this.limbik.HeadTarget = this._ikHeadBone;
         }
         this.limbik.LeftHandTarget  = this.LeftEffector.transform;
         this.limbik.RightHandTarget = this.RightEffector.transform;
     }
     else
     {
         this._currentIkType = IkController.IkType.None;
         Debug.Log("IkController: Invalid IK Type specified:" + iktype);
     }
     if (reinit && this.animationController != null)
     {
         Debug.Log(string.Concat(new object[]
         {
             "IK[",
             this._player.name,
             "] Reset To:",
             this._currentIkType
         }));
         this.animationController.ResetIKSystem(this._modelAnimator, true, this._currentIkType);
     }
 }
示例#2
0
 // Token: 0x06004F17 RID: 20247 RVA: 0x001AA2CC File Offset: 0x001A86CC
 public void Initialize(IkController.IkType ikType, Animator modelAnimator, VRCPlayer player, bool local)
 {
     this._player                  = player;
     this.isLocalPlayer            = local;
     this.animationController      = base.GetComponentInParent <VRC_AnimationController>();
     this._completedUSpeakMove     = false;
     this._reportedUSpeakMoveError = false;
     this._elapsedUSpeakTimeToMove = 0f;
     this._useLimbIK               = false;
     this._useVrcTrackedIk         = false;
     if (modelAnimator != null && modelAnimator.isHuman && modelAnimator.runtimeAnimatorController != null)
     {
         this._modelAnimator = modelAnimator;
         this.SetIkType(ikType, false);
         this._locoLayer = this.GetMatchingLayerIndex(this._modelAnimator, "locomotion");
     }
     else
     {
         this._modelAnimator = null;
         this._locoLayer     = -1;
     }
     if (local)
     {
         this.leftHandGrasper            = this.LeftEffector.gameObject.AddMissingComponent <VRCHandGrasper>();
         this.leftHandGrasper.DropInput  = VRCInputManager.FindInput("DropLeft");
         this.leftHandGrasper.UseInput   = VRCInputManager.FindInput("UseLeft");
         this.leftHandGrasper.GrabInput  = VRCInputManager.FindInput("GrabLeft");
         this.leftHandGrasper.RightHand  = false;
         this.rightHandGrasper           = this.RightEffector.gameObject.AddMissingComponent <VRCHandGrasper>();
         this.rightHandGrasper.DropInput = VRCInputManager.FindInput("DropRight");
         this.rightHandGrasper.UseInput  = VRCInputManager.FindInput("UseRight");
         this.rightHandGrasper.GrabInput = VRCInputManager.FindInput("GrabRight");
         this.rightHandGrasper.RightHand = true;
     }
     this.motion = this.animationController.GetComponentInParent <VRCMotionState>();
     this.motion.StandingHeight = 1f;
     this._inited = true;
     this._completedUSpeakMove = false;
 }
示例#3
0
    // Token: 0x06004FF5 RID: 20469 RVA: 0x001B4CCC File Offset: 0x001B30CC
    public void Reset(Animator animator, VRC_AvatarDescriptor ad)
    {
        this.ResetInUseComponents();
        this._animator = animator;
        if (ad == null)
        {
            ad = base.transform.parent.GetComponentInChildren <VRC_AvatarDescriptor>();
        }
        GameObject gameObject = ad.gameObject;

        base.GetComponent <PoseRecorder>().Initialize(this._animator, this.avatarRoot);
        if (this.Kinect != null && this.RunKinect)
        {
            this.Kinect.GetComponent <KinectAvatarController>().Initialize(animator, base.isMine);
        }
        if (this._avatarAnimation != null)
        {
            this._avatarAnimation.Initialize(animator, base.isMine);
        }
        if (animator != null && animator.isHuman)
        {
            if (this._player != null && this._emotePlayer != null)
            {
                this._emotePlayer.Initialize(this._animator, base.isMine);
            }
            IkController.IkType ikType = this.ResetIKSystem(animator, false, IkController.IkType.None);
            this._ikController = this.HeadAndHandsIkController.GetComponent <IkController>();
            if (this._ikController != null)
            {
                this._ikController.Initialize(ikType, animator, this._player, base.isMine);
            }
            if (ad != null)
            {
                switch (ad.lipSync)
                {
                case VRC_AvatarDescriptor.LipSyncStyle.Default:
                case VRC_AvatarDescriptor.LipSyncStyle.JawFlapBone:
                case VRC_AvatarDescriptor.LipSyncStyle.JawFlapBlendShape:
                    if (this.jawController != null)
                    {
                        this.lipsyncController.DisableLipSyncComponents();
                        this.lipsyncController.enabled             = false;
                        this.jawController.MouthOpenBlendShapeName = ad.MouthOpenBlendShapeName;
                        this.jawController.enabled = true;
                        this.jawController.Initialize(gameObject, animator, base.isMine);
                    }
                    break;

                case VRC_AvatarDescriptor.LipSyncStyle.VisemeBlendShape:
                    if (ad.VisemeSkinnedMesh != null)
                    {
                        if (this.jawController != null)
                        {
                            this.jawController.enabled = false;
                        }
                        this.lipsyncController.enabled = true;
                        this.lipsyncController.InitializeBlendShapes(ad.VisemeBlendShapes, gameObject, animator, ad.VisemeSkinnedMesh, base.isMine);
                    }
                    break;
                }
            }
            if (this.lookController != null)
            {
                if (this.lookController.Initialize(animator, this.usingVRIK))
                {
                    this.lookController.enabled = true;
                }
                else
                {
                    this.lookController.enabled = false;
                }
            }
            if (this._ragdollController != null)
            {
                this._ragdollController.Initialize(animator, base.isMine);
            }
            if (this._handGestureController != null && !this.usingVRIK)
            {
                this.SetupHandGestures(animator, base.isMine);
            }
        }
        if (this._player != null && animator != null && base.isMine)
        {
            this._meatHook.Attach(animator);
        }
        this.cameraMountController.Initialize(ad, animator, base.isMine);
        if (base.isMine)
        {
            if (this.muteController != null)
            {
                this.muteController.LocalMute();
            }
            else if (this.muteController != null)
            {
                this.muteController.Reset();
            }
        }
    }
示例#4
0
 // Token: 0x06004FF4 RID: 20468 RVA: 0x001B492C File Offset: 0x001B2D2C
 public IkController.IkType ResetIKSystem(Animator animator, bool forceIkType, IkController.IkType forceToType)
 {
     if (animator.transform.parent != null)
     {
         this._avatarSwitcher = animator.transform.parent.GetComponent <VRCAvatarManager>();
     }
     if (this._avatarSwitcher == null)
     {
         forceIkType = true;
         forceToType = IkController.IkType.None;
     }
     else if (this._avatarSwitcher.currentAvatarKind != VRCAvatarManager.AvatarKind.Custom)
     {
         forceIkType = true;
         forceToType = IkController.IkType.Limb;
     }
     this.vrik       = animator.GetComponent <VRIK>();
     this.fbbik      = animator.GetComponent <FullBodyBipedIK>();
     this.limbik     = animator.GetComponent <global::LimbIK>();
     this.usingFBBIK = false;
     this.usingVRIK  = false;
     if (this._player != null && this.HeadAndHandsIkController != null)
     {
         this._vrcVrIkController  = this.HeadAndHandsIkController.GetComponent <VRCVrIkController>();
         this._vrcFbbIkController = this.HeadAndHandsIkController.GetComponent <VRCFbbIkController>();
         if (this.limbik != null && this.vrik != null && this.fbbik != null && this._vrcVrIkController != null && this._vrcFbbIkController != null)
         {
             if ((forceIkType && forceToType == IkController.IkType.SixPoint) || (!forceIkType && base.isMine && VRCTrackingManager.CanSupportHipAndFeetTracking()))
             {
                 this._vrcVrIkController.enabled  = false;
                 this._vrcFbbIkController.enabled = true;
                 if (this._vrcFbbIkController.Initialize(this, animator, this._player, base.isMine))
                 {
                     this.usingFBBIK     = true;
                     this.fbbik.enabled  = true;
                     this.usingVRIK      = false;
                     this.vrik.enabled   = false;
                     this.limbik.enabled = false;
                     Debug.Log("IK[" + this._player.name + "]: 6 Point IK");
                     return(IkController.IkType.SixPoint);
                 }
             }
             if ((forceIkType && forceToType == IkController.IkType.ThreeOrFourPoint) || (!forceIkType && !this.usingFBBIK && this._vrcVrIkController != null))
             {
                 this._vrcVrIkController.enabled  = true;
                 this._vrcFbbIkController.enabled = false;
                 if (this._vrcVrIkController.Initialize(this, animator, this._player, base.isMine))
                 {
                     this.usingVRIK      = true;
                     this.vrik.enabled   = true;
                     this.usingFBBIK     = false;
                     this.fbbik.enabled  = false;
                     this.limbik.enabled = false;
                     Debug.Log("IK[" + this._player.name + "]: 3/4 Point IK");
                     return(IkController.IkType.ThreeOrFourPoint);
                 }
             }
             if ((forceIkType && forceToType == IkController.IkType.Limb) || (!forceIkType && !this.usingFBBIK && !this.usingVRIK))
             {
                 this.limbik.enabled              = true;
                 this._vrcVrIkController.enabled  = false;
                 this._vrcVrIkController          = null;
                 this._vrcFbbIkController.enabled = false;
                 this._vrcFbbIkController         = null;
                 this.usingVRIK     = false;
                 this.vrik.enabled  = false;
                 this.usingFBBIK    = false;
                 this.fbbik.enabled = false;
                 Debug.Log("IK[" + this._player.name + "]: Limb IK");
                 return(IkController.IkType.Limb);
             }
         }
     }
     this._vrcVrIkController  = null;
     this._vrcFbbIkController = null;
     this._ikController       = null;
     this.usingVRIK           = false;
     this.vrik.enabled        = false;
     this.usingFBBIK          = false;
     this.fbbik.enabled       = false;
     this.limbik.enabled      = false;
     Debug.Log("IK Mode: None");
     return(IkController.IkType.None);
 }