void SetupPlayer()
        {
            if (m_target != null)
            {
                m_blendShape = m_target.GetComponent <VRMBlendShapeProxy>();
                // ToDo: blendShape コントローラーへの紐づけ

                m_firstPerson = m_target.GetComponent <VRMFirstPerson>();
                m_firstPerson.Setup();

                // AnimationController の紐づけ
                var animator = m_target.GetComponent <Animator>();
                if (animator != null)
                {
                    animator.runtimeAnimatorController = m_animationController;
                }

/*
 *              // VRIKのセットアップサンプル
 *              VRIK m_vrik = m_target.gameObject.AddComponent<VRIK>();
 *              m_vrik.AutoDetectReferences();
 *              m_vrik.solver.spine.headTarget = m_headTarget;
 *              m_vrik.solver.leftArm.target = m_leftHandTarget;
 *              m_vrik.solver.rightArm.target = m_rightHandTarget;
 *              m_vrik.solver.leftArm.stretchCurve = new AnimationCurve();
 *              m_vrik.solver.rightArm.stretchCurve = new AnimationCurve();
 *              IKSolverVR.Locomotion m_vrikLoco = m_vrik.solver.locomotion;
 *              m_vrikLoco.footDistance = 0.1f;
 *              m_vrikLoco.stepThreshold = 0.2f;
 */
            }
        }
Example #2
0
        public void SetVideoChatMode(VRMLookAtHead lookAtHead, LookAtIK lookAtIk, VRMFirstPerson firstPerson)
        {
            lookAtHead.Target      = Camera.main.transform;
            lookAtIk.solver.target = lookAtHead.Target;
            var headCenter = firstPerson.FirstPersonBone.localToWorldMatrix.MultiplyPoint(firstPerson.FirstPersonOffset);

            headCenter.z = .9f;
            Camera.main.transform.position = headCenter;
            _receivedMessageHandler.ReceiveCommand(new ReceivedCommand(MessageCommandNames.EnableDesktopShareMode, false.ToString()));
        }
 private void Awake()
 {
     initialPosition      = transform.position;
     _loadable.VrmLoaded += info => _firstPerson = info.vrmRoot.GetComponent <VRMFirstPerson>();
     _receivedMessageHandler.Commands.Subscribe(message =>
     {
         switch (message.Command)
         {
         case MessageCommandNames.CameraControl:
             {
                 enabled = message.ToBoolean();
                 break;
             }
         }
     });
 }
Example #4
0
        void SetupTarget()
        {
            if (m_target != null)
            {
                m_target.Source     = m_source;
                m_target.SourceType = UniHumanoid.HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer;

                m_blendShape = m_target.GetComponent <VRMBlendShapeProxy>();

                m_firstPerson = m_target.GetComponent <VRMFirstPerson>();

                var animator = m_target.GetComponent <Animator>();
                if (animator != null)
                {
                    animator.runtimeAnimatorController = m_animationController;
                    VRIK m_vrik = m_target.gameObject.AddComponent <VRIK>();
                    m_vrik.AutoDetectReferences();
                    m_vrik.solver.spine.headTarget      = m_headTarget;
                    m_vrik.solver.leftArm.target        = m_leftHandTarget;
                    m_vrik.solver.rightArm.target       = m_rightHandTarget;
                    m_vrik.solver.leftArm.stretchCurve  = new AnimationCurve();
                    m_vrik.solver.rightArm.stretchCurve = new AnimationCurve();
                    IKSolverVR.Locomotion m_vrikLoco = m_vrik.solver.locomotion;
                    m_vrikLoco.footDistance  = 0.1f;
                    m_vrikLoco.stepThreshold = 0.2f;

                    VRIKCalibrator.Calibrate(m_vrik, null, m_headTarget, null, m_leftHandTarget, m_rightHandTarget, null, null);

                    m_firstPerson.Setup();

                    _handPoseController.SetAnimaor(animator);
                    if (m_faceCamera != null)
                    {
                        m_faceCamera.Target = animator.GetBoneTransform(HumanBodyBones.Head);
                    }
                }
            }
        }
        void SetupTarget()
        {
            if (m_target != null)
            {
                m_target.Source     = m_source;
                m_target.SourceType = UniHumanoid.HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer;

                m_blendShape = m_target.GetComponent <VRMBlendShapeProxy>();

                m_firstPerson = m_target.GetComponent <VRMFirstPerson>();

                var animator = m_target.GetComponent <Animator>();
                if (animator != null)
                {
                    m_firstPerson.Setup();

                    if (m_faceCamera != null)
                    {
                        m_faceCamera.Target = animator.GetBoneTransform(HumanBodyBones.Head);
                    }
                }
            }
        }