async void LoadVRMClicked() { #if UNITY_STANDALONE_WIN var path = VRM10FileDialogForWindows.FileDialog("open VRM", ".vrm"); #elif UNITY_EDITOR var path = UnityEditor.EditorUtility.OpenFilePanel("Open VRM", "", "vrm"); #else var path = Application.dataPath + "/default.vrm"; #endif if (string.IsNullOrEmpty(path)) { return; } var instance = await LoadAsync(path, new VRMShaders.RuntimeOnlyAwaitCaller()); var root = instance.gameObject; root.transform.SetParent(transform, false); // add motion var humanPoseTransfer = root.AddComponent <UniHumanoid.HumanPoseTransfer>(); if (m_target != null) { GameObject.Destroy(m_target.gameObject); } m_target = humanPoseTransfer; SetupTarget(m_target); }
void OnLoaded(GameObject root) { root.transform.SetParent(transform, false); // add motion var humanPoseTransfer = root.AddComponent <UniHumanoid.HumanPoseTransfer>(); if (m_target != null) { GameObject.Destroy(m_target.gameObject); } m_target = humanPoseTransfer; SetupTarget(); }
void OnLoaded(GameObject root) { // 設置先 hierarchy を決める root.transform.SetParent(transform, false); // humanPoseTransfer 追加 var humanPoseTransfer = root.AddComponent <UniHumanoid.HumanPoseTransfer>(); if (m_target != null) { GameObject.Destroy(m_target.gameObject); } m_target = humanPoseTransfer; SetupPlayer(); }
void LoadBvh(string path) { Debug.LogFormat("ImportBvh: {0}", path); var context = new UniHumanoid.BvhImporterContext(); context.Parse(path); context.Load(); if (m_source != null) { GameObject.Destroy(m_source.gameObject); } m_source = context.Root.GetComponent <UniHumanoid.HumanPoseTransfer>(); SetupTarget(); }
void OnLoaded(VRMImporterContext context) { var root = context.Root; root.transform.SetParent(transform, false); //メッシュを表示します context.ShowMeshes(); // add motion var humanPoseTransfer = root.AddComponent <UniHumanoid.HumanPoseTransfer>(); if (m_target != null) { GameObject.Destroy(m_target.gameObject); } m_target = humanPoseTransfer; SetupTarget(); }
void OnLoaded(RuntimeGltfInstance loaded) { var root = loaded.gameObject; root.transform.SetParent(transform, false); //メッシュを表示します loaded.ShowMeshes(); // add motion var humanPoseTransfer = root.AddComponent <UniHumanoid.HumanPoseTransfer>(); if (m_target != null) { GameObject.Destroy(m_target.gameObject); } m_target = humanPoseTransfer; SetupTarget(); }
void SetupTarget(UniHumanoid.HumanPoseTransfer m_target) { if (m_target == null) { return; } m_target.Source = m_source; m_target.SourceType = UniHumanoid.HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer; var animator = m_target.GetComponent <Animator>(); if (animator != null) { if (m_faceCamera != null) { m_faceCamera.Target = animator.GetBoneTransform(HumanBodyBones.Head); } } }