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;
 */
            }
        }
Exemplo n.º 2
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);
                    }
                }
            }
        }