From c9ab42e2910b650c7caebcbdd1e7277a08560a1d Mon Sep 17 00:00:00 2001 From: sh_akira Date: Mon, 13 Aug 2018 14:24:56 +0900 Subject: [PATCH] =?UTF-8?q?0.07=20externalcamera=E3=81=AE=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E5=85=88=E3=82=B3=E3=83=B3=E3=83=88=E3=83=AD=E3=83=BC?= =?UTF-8?q?=E3=83=A9=E9=81=B8=E6=8A=9E=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OVRTracking/Scripts/TrackerHandler.cs | 9 ++ Assets/Scenes/VirtualMotionCapture.unity | 116 ++++++++++++++++++ Assets/Scripts/ControlWPFWindow.cs | 20 +-- .../ControlWindowWPF/SettingWindow.xaml | 6 +- .../ControlWindowWPF/SettingWindow.xaml.cs | 2 +- .../VirtualMotionCaptureControlPanel.exe | Bin 163840 -> 163840 bytes README.md | 8 +- UnityNamedPipeCommand/PipeCommands.cs | 2 +- 8 files changed, 150 insertions(+), 13 deletions(-) diff --git a/Assets/ExternalPlugins/OVRTracking/Scripts/TrackerHandler.cs b/Assets/ExternalPlugins/OVRTracking/Scripts/TrackerHandler.cs index d271a607..b6a740fd 100644 --- a/Assets/ExternalPlugins/OVRTracking/Scripts/TrackerHandler.cs +++ b/Assets/ExternalPlugins/OVRTracking/Scripts/TrackerHandler.cs @@ -11,6 +11,9 @@ public class TrackerHandler : MonoBehaviour public GameObject HMDObject; public GameObject LeftControllerObject; public GameObject RightControllerObject; + public GameObject CameraControllerObject; + [System.NonSerialized] + public int CameraControllerIndex = -1; [System.NonSerialized] public List Trackers = new List(); public List TrackersObject = new List(); @@ -48,6 +51,12 @@ void Update() var controllerPositions = positions[ETrackedDeviceClass.Controller]; if (controllerPositions.Any()) { + //externalcamera.cfg用のコントローラー設定 + if (CameraControllerIndex >= 0 && CameraControllerIndex < controllerPositions.Count) + { + CameraControllerObject.transform.SetPositionAndRotation(controllerPositions[CameraControllerIndex]); + controllerPositions.RemoveAt(CameraControllerIndex); + } LeftControllerObject.transform.SetPositionAndRotation(controllerPositions.FirstOrDefault()); if (controllerPositions.Count > 1) { diff --git a/Assets/Scenes/VirtualMotionCapture.unity b/Assets/Scenes/VirtualMotionCapture.unity index 827ccf41..861fa616 100644 --- a/Assets/Scenes/VirtualMotionCapture.unity +++ b/Assets/Scenes/VirtualMotionCapture.unity @@ -113,6 +113,91 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &24719457 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 24719458} + - component: {fileID: 24719461} + - component: {fileID: 24719460} + - component: {fileID: 24719459} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &24719458 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 24719457} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.08, y: 0.08, z: 0.2} + m_Children: [] + m_Father: {fileID: 696852443} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!65 &24719459 +BoxCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 24719457} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &24719460 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 24719457} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &24719461 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 24719457} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &54464774 GameObject: m_ObjectHideFlags: 0 @@ -967,6 +1052,35 @@ Transform: m_Father: {fileID: 1128534204} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &696852442 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 696852443} + m_Layer: 0 + m_Name: CameraController + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &696852443 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 696852442} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 1, y: 1.3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 24719458} + m_Father: {fileID: 1128534204} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &716008275 GameObject: m_ObjectHideFlags: 0 @@ -1293,6 +1407,7 @@ MonoBehaviour: HMDObject: {fileID: 131724274} LeftControllerObject: {fileID: 617002694} RightControllerObject: {fileID: 1766301012} + CameraControllerObject: {fileID: 696852442} TrackersObject: - {fileID: 1682114101} - {fileID: 1466831150} @@ -1319,6 +1434,7 @@ Transform: - {fileID: 801812189} - {fileID: 1255601379} - {fileID: 1653217472} + - {fileID: 696852443} m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/ControlWPFWindow.cs b/Assets/Scripts/ControlWPFWindow.cs index 69a688a3..462000aa 100644 --- a/Assets/Scripts/ControlWPFWindow.cs +++ b/Assets/Scripts/ControlWPFWindow.cs @@ -344,16 +344,16 @@ await mainThreadInvoker.InvokeAsync(async () => var d = (PipeCommands.SetExternalCameraConfig)e.Data; //フリーカメラに変更 ChangeCamera(CameraTypes.Free); - //externalcamera.cfgはベースステーション基準のポジション - //いったんベースステーションの子にして座標指定したら、 - currentCamera.transform.SetParent(handler.BaseStations[d.BaseStationIndex].transform); + //externalcamera.cfgは3つ目のコントローラー基準のポジション + handler.CameraControllerIndex = d.ControllerIndex; + //指定のコントローラーの子にして座標指定 + currentCamera.transform.SetParent(handler.CameraControllerObject.transform); currentCamera.transform.localPosition = new Vector3(d.x, d.y, d.z); currentCamera.transform.localRotation = Quaternion.Euler(d.rx, d.ry, d.rz); currentCamera.fieldOfView = d.fov; - //座標を維持したままルートに配置しなおす - currentCamera.transform.SetParent(null, true); - if (CurrentSettings.FreeCameraTransform == null) CurrentSettings.FreeCameraTransform = new StoreTransform(currentCamera.transform); - CurrentSettings.FreeCameraTransform.SetPosition(currentCamera.transform); + //コントローラーは動くのでカメラ位置の保存はできない + //if (CurrentSettings.FreeCameraTransform == null) CurrentSettings.FreeCameraTransform = new StoreTransform(currentCamera.transform); + //CurrentSettings.FreeCameraTransform.SetPosition(currentCamera.transform); } else if (e.CommandType == typeof(PipeCommands.LoadCurrentSettings)) { @@ -455,6 +455,12 @@ private async void ImportVRM(string path, bool ImportForCalibration) // ParseしたJSONをシーンオブジェクトに変換していく CurrentModel = await VRMImporter.LoadVrmAsync(context); + //モデルのSkinnedMeshRendererがカリングされないように、すべてのオプション変更 + foreach(var renderer in CurrentModel.GetComponentsInChildren(true)) + { + renderer.updateWhenOffscreen = true; + } + //LipSync LipSync.ImportVRMmodel(CurrentModel); //まばたき diff --git a/ControlWindowWPF/ControlWindowWPF/SettingWindow.xaml b/ControlWindowWPF/ControlWindowWPF/SettingWindow.xaml index d9c17611..a3d61a3f 100644 --- a/ControlWindowWPF/ControlWindowWPF/SettingWindow.xaml +++ b/ControlWindowWPF/ControlWindowWPF/SettingWindow.xaml @@ -20,10 +20,12 @@