示例#1
0
        void SetModel(GameObject go)
        {
            // cleanup
            if (m_loaded != null)
            {
                GameObject.Destroy(m_loaded);
            }

            m_loaded = go;

            var dst = m_loaded.AddComponent <HumanPoseTransfer>();

            dst.Source     = m_src;
            dst.SourceType = HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer;

            m_lipSync = go.AddComponent <AIUEO>();
            m_blink   = go.AddComponent <Blinker>();

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

            lookAt.Target     = m_target.transform;
            lookAt.UpdateType = UpdateType.LateUpdate; // after HumanPoseTransfer's setPose
        }
示例#2
0
        void SetModel(GameObject go)
        {
            // cleanup
            var loaded = m_loaded;

            m_loaded = null;

            if (loaded != null)
            {
                Debug.LogFormat("destroy {0}", loaded);
                GameObject.Destroy(loaded.gameObject);
            }

            if (go != null)
            {
                var lookAt = go.GetComponent <VRMLookAtHead>();
                if (lookAt != null)
                {
                    m_loaded            = go.AddComponent <HumanPoseTransfer>();
                    m_loaded.Source     = m_src;
                    m_loaded.SourceType = HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer;

                    m_lipSync = go.AddComponent <AIUEO>();
                    m_blink   = go.AddComponent <Blinker>();

                    lookAt.Target     = m_target.transform;
                    lookAt.UpdateType = UpdateType.LateUpdate; // after HumanPoseTransfer's setPose
                }

                var animation = go.GetComponent <Animation>();
                if (animation && animation.clip != null)
                {
                    animation.Play(animation.clip.name);
                }
            }
        }