From fcd1a01b882f7d076a1e1f4970ccef8b549052b4 Mon Sep 17 00:00:00 2001 From: from2001 Date: Fri, 3 Apr 2015 13:23:21 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=82=B9=E3=82=B1=E3=83=AB=E3=83=88?= =?UTF-8?q?=E3=83=B3=E3=81=8C=E7=94=BB=E9=9D=A2=E5=B7=A6=E5=8F=B3=E3=81=A7?= =?UTF-8?q?=E3=81=9A=E3=82=8C=E3=82=8B=E5=95=8F=E9=A1=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BodySourceView.cs内でスケルトンの変換方法を修正 それに合わせシーンのQuad、MainCameraの位置を調整 --- .../Assets/K4W/KinectView/Scripts/BodySourceView.cs | 10 ++++------ .../Assets/Scenes/CoodinateSample.unity | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CoodinateMapKinectToUnity/Assets/K4W/KinectView/Scripts/BodySourceView.cs b/CoodinateMapKinectToUnity/Assets/K4W/KinectView/Scripts/BodySourceView.cs index 9c36176..c405b3f 100644 --- a/CoodinateMapKinectToUnity/Assets/K4W/KinectView/Scripts/BodySourceView.cs +++ b/CoodinateMapKinectToUnity/Assets/K4W/KinectView/Scripts/BodySourceView.cs @@ -200,13 +200,11 @@ private Vector3 GetVector3FromJoint(Kinect.Joint joint) // KinectのCamera座標系(3次元)をColor座標系(2次元)に変換する var point =_CoordinateMapper.MapCameraPointToColorSpace( joint.Position ); var point2 = new Vector3( point.X, point.Y, 0 ); - if ( (0<= point2.x) && (point2.x < SensorWidth) && (0 <= point2.y) && (point2.y < SensorHeight) ) { - // スクリーンサイズで調整(Kinect->Unity) - point2.x = point2.x * Screen.width / SensorWidth; - point2.y = point2.y * Screen.height / SensorHeight; + if ((0 <= point2.x) && (point2.x < SensorWidth) && (0 <= point2.y) && (point2.y < SensorHeight)){ + + //Quadの大きさに合わせてスケーリング + var colorPoint3 = new Vector3(point2.x * 16 / 1920, point2.y * 9 / 1080, 0); - // Unityのワールド座標系(3次元)に変換 - var colorPoint3 = _Camera.ScreenToWorldPoint( point2 ); // 座標の調整 // Y座標は逆、Z座標は0にする(Xもミラー状態によって逆にする必要あり) diff --git a/CoodinateMapKinectToUnity/Assets/Scenes/CoodinateSample.unity b/CoodinateMapKinectToUnity/Assets/Scenes/CoodinateSample.unity index d979be9..e3b0755 100644 --- a/CoodinateMapKinectToUnity/Assets/Scenes/CoodinateSample.unity +++ b/CoodinateMapKinectToUnity/Assets/Scenes/CoodinateSample.unity @@ -73,6 +73,7 @@ NavMeshSettings: minRegionArea: 2 widthInaccuracy: 16.666666 heightInaccuracy: 10 + tileSizeHint: 0 m_NavMesh: {fileID: 0} --- !u!1 &236295980 GameObject: @@ -227,7 +228,6 @@ MonoBehaviour: BoneMaterial: {fileID: 2100000, guid: f2ea145c63353784985576f08398a815, type: 2} BodySourceManager: {fileID: 236295980} Camera: {fileID: 1045325165} - IsCoodinateColor: 1 --- !u!4 &729636175 Transform: m_ObjectHideFlags: 0 @@ -389,7 +389,7 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 985433717} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 8, y: -4.5, z: 0} m_LocalScale: {x: 16, y: 9, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -646,7 +646,7 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1874380095} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -7.5} + m_LocalPosition: {x: 8, y: -4.5, z: -7.5} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} From 2c100a7ebb2a60879e302a271fc13a13562a9713 Mon Sep 17 00:00:00 2001 From: from2001 Date: Fri, 3 Apr 2015 13:31:44 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectSettings/GraphicsSettings.asset | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CoodinateMapKinectToUnity/ProjectSettings/GraphicsSettings.asset b/CoodinateMapKinectToUnity/ProjectSettings/GraphicsSettings.asset index 553f97d..f475482 100644 --- a/CoodinateMapKinectToUnity/ProjectSettings/GraphicsSettings.asset +++ b/CoodinateMapKinectToUnity/ProjectSettings/GraphicsSettings.asset @@ -3,5 +3,8 @@ --- !u!30 &1 GraphicsSettings: m_ObjectHideFlags: 0 + serializedVersion: 2 m_AlwaysIncludedShaders: - - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 0} + - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}