private void OnVrmLoaded(VrmLoadedInfo info)
        {
            _blendShapeProxy = info.blendShape;
            _rightEyeBone    = info.animator.GetBoneTransform(HumanBodyBones.RightEye);
            _leftEyeBone     = info.animator.GetBoneTransform(HumanBodyBones.LeftEye);

            _hasValidEyeSettings =
                _rightEyeBone != null &&
                _leftEyeBone != null &&
                CheckBlinkBlendShapeClips(_blendShapeProxy);

            IsInitialized = true;
        }
Ejemplo n.º 2
0
        private void OnVrmLoaded(VrmLoadedInfo info)
        {
            string names = string.Join(",",
                                       info.blendShape
                                       .BlendShapeAvatar
                                       .Clips
                                       .Select(c => c.BlendShapeName)
                                       .Where(n => !BasicNames.Contains(n))
                                       );

            _sender.SendCommand(
                MessageFactory.Instance.ExtraBlendShapeClipNames(names)
                );
        }
Ejemplo n.º 3
0
        private void OnVrmLoaded(VrmLoadedInfo info)
        {
            _ik = info.vrmRoot.GetComponent <FullBodyBipedIK>();
            var spineBone = info.animator.GetBoneTransform(HumanBodyBones.Spine);

            _rightArmBendGoal = new GameObject().transform;
            _rightArmBendGoal.SetParent(spineBone);
            _rightArmBendGoal.localRotation = Quaternion.identity;
            _ik.solver.rightArmChain.bendConstraint.bendGoal = _rightArmBendGoal;

            _leftArmBendGoal = new GameObject().transform;
            _leftArmBendGoal.SetParent(spineBone);
            _leftArmBendGoal.localRotation = Quaternion.identity;
            _ik.solver.leftArmChain.bendConstraint.bendGoal = _leftArmBendGoal;

            _isInitialized = true;
        }
Ejemplo n.º 4
0
        private void SetModel(GameObject go)
        {
            ReleaseCurrentVrm();

            if (go == null)
            {
                return;
            }

            var lookAt = go.GetComponent <VRMLookAtHead>();

            _humanPoseTransferTarget            = go.AddComponent <HumanPoseTransfer>();
            _humanPoseTransferTarget.SourceType = HumanPoseTransfer.HumanPoseTransferSourceType.None;
            lookAt.UpdateType = UpdateType.LateUpdate;

            //セットアップのうちFinalIKに思い切り依存した所が別スクリプトになってます
            VRMLoadControllerHelper.SetupVrm(go, loadSetting);

            var animator = go.GetComponent <Animator>();

            animator.runtimeAnimatorController = animatorController;

            var blendShapeProxy = go.GetComponent <VRMBlendShapeProxy>();

            var renderers = go.GetComponentsInChildren <Renderer>();

            foreach (var r in renderers)
            {
                //セルフシャドウは明示的に切る: ちょっとでも軽量化したい
                r.receiveShadows = false;
            }
            windowStyleController.InitializeModelRenderers(renderers);
            settingAdjuster.AssignModelRoot(go.transform);

            var info = new VrmLoadedInfo()
            {
                vrmRoot    = go.transform,
                animator   = animator,
                blendShape = blendShapeProxy,
            };

            PreVrmLoaded?.Invoke(info);
            VrmLoaded?.Invoke(info);
        }
Ejemplo n.º 5
0
        private void OnVrmLoaded(VrmLoadedInfo info)
        {
            _blendShapeProxy = info.blendShape;
            _rightEyeBone    = info.animator.GetBoneTransform(HumanBodyBones.RightEye);
            _leftEyeBone     = info.animator.GetBoneTransform(HumanBodyBones.LeftEye);

            _rightEyeBrowHeight?.Dispose();
            _rightEyeBrowHeight         = _faceTracker.FaceParts.RightEyebrow.Height.Subscribe(
                v => _rightEyeBrowValue = v
                );

            _leftEyeBrowHeight?.Dispose();
            _leftEyeBrowHeight         = _faceTracker.FaceParts.LeftEyebrow.Height.Subscribe(
                v => _leftEyeBrowValue = v
                );

            _hasValidEyeSettings =
                _rightEyeBone != null &&
                _leftEyeBone != null &&
                CheckBlinkBlendShapeClips(_blendShapeProxy);

            IsInitialized = true;
        }
Ejemplo n.º 6
0
 private void OnVrmLoaded(VrmLoadedInfo info)
 {
     _vrm = info.vrmRoot.gameObject;
     ReplaceComponents.ReplaceJobs(_vrm);
     _scheduler.AddBuffer(_vrm);
 }
Ejemplo n.º 7
0
 public void OnVrmLoaded(VrmLoadedInfo info)
 {
     InitializeBlendShapeItems(info.vrmRoot);
     IsInitialized = true;
 }
Ejemplo n.º 8
0
        private void OnVrmLoaded(VrmLoadedInfo info)
        {
            _animator         = info.animator;
            _humanPoseHandler = new HumanPoseHandler(_animator.avatar, _animator.transform);
            //とりあえず現在の値を拾っておく
            _humanPoseHandler.GetHumanPose(ref _humanPose);
            _defaultHumanPose = _humanPose;

            for (int i = 0; i < 10; i++)
            {
                _hold[i]         = false;
                _targetAngles[i] = DefaultBendingAngle;
            }

            _fingers = new Transform[][]
            {
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.LeftThumbDistal),
                    _animator.GetBoneTransform(HumanBodyBones.LeftThumbIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.LeftThumbProximal),
                },
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.LeftIndexDistal),
                    _animator.GetBoneTransform(HumanBodyBones.LeftIndexIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.LeftIndexProximal),
                },
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.LeftMiddleDistal),
                    _animator.GetBoneTransform(HumanBodyBones.LeftMiddleIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.LeftMiddleProximal),
                },
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.LeftRingDistal),
                    _animator.GetBoneTransform(HumanBodyBones.LeftRingIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.LeftRingProximal),
                },
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.LeftLittleDistal),
                    _animator.GetBoneTransform(HumanBodyBones.LeftLittleIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.LeftLittleProximal),
                },
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.RightThumbDistal),
                    _animator.GetBoneTransform(HumanBodyBones.RightThumbIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.RightThumbProximal),
                },
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.RightIndexDistal),
                    _animator.GetBoneTransform(HumanBodyBones.RightIndexIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.RightIndexProximal),
                },
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.RightMiddleDistal),
                    _animator.GetBoneTransform(HumanBodyBones.RightMiddleIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.RightMiddleProximal),
                },
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.RightRingDistal),
                    _animator.GetBoneTransform(HumanBodyBones.RightRingIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.RightRingProximal),
                },
                new Transform[]
                {
                    _animator.GetBoneTransform(HumanBodyBones.RightLittleDistal),
                    _animator.GetBoneTransform(HumanBodyBones.RightLittleIntermediate),
                    _animator.GetBoneTransform(HumanBodyBones.RightLittleProximal),
                },
            };
        }
Ejemplo n.º 9
0
 private void OnVrmLoaded(VrmLoadedInfo info)
 {
     _hasModel = true;
 }
Ejemplo n.º 10
0
 private void OnVrmLoaded(VrmLoadedInfo info)
 {
     _rightEye        = info.animator.GetBoneTransform(HumanBodyBones.RightEye);
     _leftEye         = info.animator.GetBoneTransform(HumanBodyBones.LeftEye);
     _hasValidEyeBone = (_rightEye != null && _leftEye != null);
 }