add basic kinect skelton

This commit is contained in:
Chikashi Miyama 2019-10-31 21:08:01 +01:00
parent fc8999d26c
commit ab662ba326
3 changed files with 132 additions and 128 deletions

View file

@ -120,115 +120,6 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &863219604
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 863219609}
- component: {fileID: 863219608}
- component: {fileID: 863219607}
- component: {fileID: 863219606}
- component: {fileID: 863219605}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!111 &863219605
Animation:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863219604}
m_Enabled: 1
serializedVersion: 3
m_Animation: {fileID: 7400000, guid: 5adbcf2e6f7f1d24e91fb33e84d0df0e, type: 2}
m_Animations:
- {fileID: 0}
m_WrapMode: 0
m_PlayAutomatically: 1
m_AnimatePhysics: 1
m_CullingType: 0
--- !u!65 &863219606
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863219604}
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 &863219607
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863219604}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
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 &863219608
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863219604}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &863219609
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863219604}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.2028971, y: -0.6283364, z: 0.5670376}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1384498139 --- !u!1001 &1384498139
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -296,6 +187,16 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4731626929094548426, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalPosition.x
value: -5
objectReference: {fileID: 0}
- target: {fileID: 4731626929094548426, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalPosition.z
value: 2.36
objectReference: {fileID: 0}
- target: {fileID: 826238034, guid: 2cf41770dc7914b46aa31a442508dd25, type: 3} - target: {fileID: 826238034, guid: 2cf41770dc7914b46aa31a442508dd25, type: 3}
propertyPath: spherePrefab propertyPath: spherePrefab
value: value:
@ -314,6 +215,7 @@ GameObject:
- component: {fileID: 1931119207} - component: {fileID: 1931119207}
- component: {fileID: 1931119206} - component: {fileID: 1931119206}
- component: {fileID: 1931119205} - component: {fileID: 1931119205}
- component: {fileID: 1931119208}
m_Layer: 0 m_Layer: 0
m_Name: Main Camera m_Name: Main Camera
m_TagString: MainCamera m_TagString: MainCamera
@ -365,8 +267,8 @@ Camera:
m_TargetTexture: {fileID: 0} m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0 m_TargetDisplay: 0
m_TargetEye: 3 m_TargetEye: 3
m_HDR: 1 m_HDR: 0
m_AllowMSAA: 1 m_AllowMSAA: 0
m_AllowDynamicResolution: 0 m_AllowDynamicResolution: 0
m_ForceIntoRT: 0 m_ForceIntoRT: 0
m_OcclusionCulling: 1 m_OcclusionCulling: 1
@ -386,6 +288,105 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1931119208
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1931119204}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
m_Name:
m_EditorClassIdentifier:
clearColorMode: 0
backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0}
clearDepth: 1
volumeLayerMask:
serializedVersion: 2
m_Bits: 1
volumeAnchorOverride: {fileID: 0}
antialiasing: 0
SMAAQuality: 2
dithering: 0
stopNaNs: 0
physicalParameters:
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
flipYMode: 0
fullscreenPassthrough: 0
allowDynamicResolution: 0
customRenderingSettings: 0
invertFaceCulling: 0
probeLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPathCustomFrameSettings:
bitDatas:
data1: 69284264935197
data2: 4539628424389459968
lodBias: 1
lodBiasMode: 0
maximumLODLevel: 0
maximumLODLevelMode: 0
renderingPathCustomFrameSettingsOverrideMask:
mask:
data1: 0
data2: 0
defaultFrameSettings: 0
m_Version: 5
m_ObsoleteRenderingPath: 0
m_ObsoleteFrameSettings:
overrides: 0
enableShadow: 0
enableContactShadows: 0
enableShadowMask: 0
enableSSR: 0
enableSSAO: 0
enableSubsurfaceScattering: 0
enableTransmission: 0
enableAtmosphericScattering: 0
enableVolumetrics: 0
enableReprojectionForVolumetrics: 0
enableLightLayers: 0
enableExposureControl: 1
diffuseGlobalDimmer: 0
specularGlobalDimmer: 0
shaderLitMode: 0
enableDepthPrepassWithDeferredRendering: 0
enableTransparentPrepass: 0
enableMotionVectors: 0
enableObjectMotionVectors: 0
enableDecals: 0
enableRoughRefraction: 0
enableTransparentPostpass: 0
enableDistortion: 0
enablePostprocess: 0
enableOpaqueObjects: 0
enableTransparentObjects: 0
enableRealtimePlanarReflection: 0
enableMSAA: 0
enableAsyncCompute: 0
runLightListAsync: 0
runSSRAsync: 0
runSSAOAsync: 0
runContactShadowsAsync: 0
runVolumeVoxelizationAsync: 0
lightLoopSettings:
overrides: 0
enableDeferredTileAndCluster: 0
enableComputeLightEvaluation: 0
enableComputeLightVariants: 0
enableComputeMaterialVariants: 0
enableFptlForForwardOpaque: 0
enableBigTilePrepass: 0
isFptlEnabled: 0
--- !u!1 &2001908821 --- !u!1 &2001908821
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -20,26 +20,26 @@ namespace cylvester
} }
} }
public void OnSkeletonFrameReceived(Body[] bodies) public void OnSkeletonFrameReceived(Body[] bodies)
{ {
if (bodies.Length == 0) foreach (var body in bodies)
return;
var body = bodies[0];
var i = 0;
foreach(var pair in body.Joints)
{ {
var joint = pair.Value; if(!body.IsTracked)
if(joint.TrackingState == TrackingState.NotTracked) continue;
balls_[i].SetActive(false);
else var i = 0;
foreach(var pair in body.Joints)
{ {
balls_[i].SetActive(true); var joint = pair.Value;
balls_[i].transform.position = new Vector3(joint.Position.X, joint.Position.Y, 0f); if(joint.TrackingState == TrackingState.NotTracked)
balls_[i].SetActive(false);
else
{
balls_[i].SetActive(true);
balls_[i].transform.position = new Vector3(joint.Position.X * 10f , joint.Position.Y * 10f, 0f);
}
i++;
} }
i++;
} }
} }
} }

View file

@ -55,9 +55,10 @@ namespace cylvester
using (var infraredFrame = eventArgs.FrameReference.AcquireFrame()) using (var infraredFrame = eventArgs.FrameReference.AcquireFrame())
{ {
if (infraredFrame == null) return; if (infraredFrame == null)
infraredFrame.CopyFrameDataToArray(irData_); return;
infraredFrame.CopyFrameDataToArray(irData_);
unsafe unsafe
{ {
fixed (ushort* irDataPtr = irData_) fixed (ushort* irDataPtr = irData_)
@ -86,6 +87,8 @@ namespace cylvester
using (var bodyFrame = eventArgs.FrameReference.AcquireFrame()) using (var bodyFrame = eventArgs.FrameReference.AcquireFrame())
{ {
if (bodyFrame == null)
return;
Array.Resize(ref bodies_, bodyFrame.BodyCount); Array.Resize(ref bodies_, bodyFrame.BodyCount);
bodyFrame.GetAndRefreshBodyData(bodies_); bodyFrame.GetAndRefreshBodyData(bodies_);
skeletonDataReceived.Invoke(bodies_); skeletonDataReceived.Invoke(bodies_);