示例#1
0
    private void OnLoadedVrm(GameObject vrm)
    {
        if (VRMRoot != null)
        {
            vrm.transform.SetParent(VRMRoot.transform, false);

            var humanPoseTransfer = vrm.AddComponent <UniHumanoid.HumanPoseTransfer>();
            if (m_target != null)
            {
                GameObject.Destroy(m_target.gameObject);
            }
            m_target = humanPoseTransfer;

            var morphTarget = vrm.AddComponent <VRMLipSyncMorphTarget>();
            morphTarget.blendShapeProxy = vrm.GetComponent <VRM.VRMBlendShapeProxy>();
            morphTarget.lipsyncContext  = lipSyncContext;

            SetupTarget();

            m_VRMObj = vrm;
            if (m_avatarPositionSynchronizer != null)
            {
                m_avatarPositionSynchronizer.AvatarPositionTransform = m_VRMObj.transform;
            }
        }
    }
示例#2
0
        public static void SetTPose(Avatar avatar, Transform transform)
        {
            var humanPoseClip = Resources.Load <HumanPoseClip>(HumanPoseClip.TPoseResourcePath);
            var pose          = humanPoseClip.GetPose();

            HumanPoseTransfer.SetPose(avatar, transform, pose);
        }
    void SetHumanPoseTransferTarget(GameObject humanPoseSynchronizer)
    {
        var humanPoseTransfer = humanPoseSynchronizer.AddComponent <UniHumanoid.HumanPoseTransfer>();

        m_target = humanPoseTransfer;
        SetupTarget();
    }
示例#4
0
 void Start()
 {
     if (Avatar != null)
     {
         var humanPoseTransfer = Avatar.AddComponent <UniHumanoid.HumanPoseTransfer>();
         m_source = humanPoseTransfer;
     }
 }
示例#5
0
    void SetHumanPoseTransferTarget(GameObject humanPoseSynchronizer)
    {
        var humanPoseTransfer = humanPoseSynchronizer.GetComponent <UniHumanoid.HumanPoseTransfer>();

        if (humanPoseTransfer != null)
        {
            m_target = humanPoseTransfer;
            SetupTarget();
        }
    }
示例#6
0
    public void OnEvent(ExitGames.Client.Photon.EventData photonEvent)
    {
        if (photonEvent.Code == (byte)VRMLiveMotionEventCode.SetHumanPoseTransferSource)
        {
            Debug.Log("OnEvent: EventCode is SetHumanPoseTransferSource");

            int receivedViewID = (int)photonEvent.Parameters[ParameterCode.Data];

            GameObject humanPoseSynchronizer = PhotonView.Find(receivedViewID).gameObject;
            m_source = humanPoseSynchronizer.GetComponent <UniHumanoid.HumanPoseTransfer>();
            humanPoseSynchronizer.GetComponent <Renderer>().enabled = false;

            SetupTarget();
        }

        if (photonEvent.Code == (byte)VRMLiveMotionEventCode.SetLipSync)
        {
            Debug.Log("OnEvent: EventCode is SetLipSync.");
            int receivedViewID = (int)photonEvent.Parameters[ParameterCode.Data];

            GameObject photonVoiceSpeaker = PhotonView.Find(receivedViewID).gameObject;
            lipSyncContext           = photonVoiceSpeaker.AddComponent <OVRLipSyncContext>();
            lipSyncContext.audioMute = false;

            var morphTarget = m_VRMObj.GetComponent <VRMLipSyncMorphTarget>();
            if (morphTarget != null)
            {
                morphTarget.lipsyncContext = lipSyncContext;
            }
        }

        if (photonEvent.Code == (byte)VRMLiveMotionEventCode.SetAvatarPositionSynchronizer)
        {
            Debug.Log("OnEvent: EventCode is SetAvatarPositionSynchronizer");
            int receivedViewID = (int)photonEvent.Parameters[ParameterCode.Data];
            var synchronizer   = PhotonView.Find(receivedViewID).gameObject.GetComponent <AvatarPositionSynchronizer>();

            if (synchronizer != null)
            {
                if (m_VRMObj != null)
                {
                    synchronizer.AvatarPositionTransform = m_VRMObj.transform;
                }
                else
                {
                    m_avatarPositionSynchronizer = synchronizer;
                }
            }
        }
    }
    private void OnLoaded(GameObject vrm)
    {
        if (VRMRoot != null)
        {
            vrm.transform.SetParent(VRMRoot.transform, false);

            // add motion
            var humanPoseTransfer = vrm.AddComponent <UniHumanoid.HumanPoseTransfer>();
            if (m_target != null)
            {
                GameObject.Destroy(m_target.gameObject);
            }
            m_target = humanPoseTransfer;

            EnableBvh();
        }
    }
示例#8
0
    void LoadBvh(string path)
    {
        Debug.LogFormat("ImportBvh: {0}", path);
        var context = new UniHumanoid.ImporterContext
        {
            Path = path
        };

        UniHumanoid.BvhImporter.Import(context);

        if (m_source != null)
        {
            GameObject.Destroy(m_source.gameObject);
        }
        m_source = context.Root.GetComponent <UniHumanoid.HumanPoseTransfer>();

        SetupTarget();
    }
示例#9
0
    IEnumerator LoadBvhCoroutine(string path)
    {
        var www = new WWW("file://" + path);

        yield return(www);

        var context = new UniHumanoid.ImporterContext
        {
            Path   = path,
            Source = www.text
        };

        ModifiedBvhImporter.Import(context);

        if (m_source != null)
        {
            GameObject.Destroy(m_source.gameObject);
        }
        m_source = context.Root.GetComponent <UniHumanoid.HumanPoseTransfer>();

        m_source.GetComponent <Renderer>().enabled = false;

        SetupTarget();
    }
示例#10
0
 public void SetTransferSource()
 {
     Source = GlobalData.GetFocusObj().GetComponent <HumanPoseTransfer>();
 }