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} 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}