add Joint Bind

This commit is contained in:
Chikashi Miyama 2019-11-03 16:05:08 +01:00
parent 646ac34143
commit 533ee9c14a
10 changed files with 417 additions and 88 deletions

View file

@ -58,6 +58,7 @@
<ItemGroup>
<Compile Include="Assets\Scenes\Examples\Composition\script\BallMapping.cs" />
<Compile Include="Assets\Scenes\Examples\Composition\script\RmsAnalyzer.cs" />
<Compile Include="Assets\Scenes\Examples\KinectSkeleton\script\RightHandMarker.cs" />
<Compile Include="Assets\Scenes\Examples\KinectSkeleton\script\Skeleton.cs" />
<Compile Include="Assets\Scenes\Examples\LevelThreshold\script\ConstructionColumnBehaviour.cs" />
<Compile Include="Assets\Scenes\Examples\LevelThreshold\script\Spawner.cs" />
@ -74,6 +75,8 @@
<Compile Include="Assets\Scenes\Examples\TimbreID\script\IdToText.cs" />
<Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\FlareBind.cs" />
<Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\SmokeBind.cs" />
<Compile Include="Assets\Scripts\Kinect\KinectJointBind.cs" />
<Compile Include="Assets\Scripts\Kinect\KinectManagerBehaviour.cs" />
<Compile Include="Assets\Scripts\Math\BodyHolder.cs" />
<Compile Include="Assets\Scripts\Math\Smoother.cs" />
<Compile Include="Assets\Scripts\Math\Threshold.cs" />
@ -102,7 +105,6 @@
<Compile Include="Assets\Scripts\StateManagement\StateManager.cs" />
<Compile Include="Assets\Scripts\TemplateLibrary\ChangeObserver.cs" />
<Compile Include="Assets\Scripts\Versioning\VersionToggleBehaviour.cs" />
<Compile Include="Assets\Scripts\VideoInput\KinectManagerBehaviour.cs" />
<Compile Include="Assets\Scripts\Visualizer\CombMesh.cs" />
<Compile Include="Assets\Scripts\Visualizer\IRPanelBehaviour.cs" />
<Compile Include="Assets\Scripts\Visualizer\SpectrumVisualizer.cs" />

View file

@ -120,90 +120,351 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &1384498139
PrefabInstance:
--- !u!1 &238320194
GameObject:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4731626927875726491, guid: 2cf41770dc7914b46aa31a442508dd25,
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 238320196}
- component: {fileID: 238320195}
m_Layer: 0
m_Name: KinectManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &238320195
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 238320194}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5b54a31bc1a14c1abb51fe86c56c6227, type: 3}
m_Name:
m_EditorClassIdentifier:
infrared: 1
infraredFrameReceived:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 583502371}
m_MethodName: OnInfraredFrameReceived
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
skeleton: 1
skeletonDataReceived:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 479263792}
m_MethodName: OnSkeletonDataReceived
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 839221375}
m_MethodName: OnSkeletonDataReceived
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
numberOfBodiesTobeTracked: 1
--- !u!4 &238320196
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 238320194}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 839221371}
- {fileID: 583502374}
- {fileID: 479263793}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &479263791
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 479263793}
- component: {fileID: 479263792}
m_Layer: 0
m_Name: Skelton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &479263792
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 479263791}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2ea1c499e186a74e9ba944b44026403, type: 3}
m_Name:
m_EditorClassIdentifier:
spherePrefab: {fileID: 7867200591126897977, guid: aa3a931c281348c4a91db2ad6fd4c7d6,
type: 3}
propertyPath: m_Name
value: KinectVisualization
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 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}
propertyPath: spherePrefab
value:
objectReference: {fileID: 7867200591126897977, guid: aa3a931c281348c4a91db2ad6fd4c7d6,
type: 3}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2cf41770dc7914b46aa31a442508dd25, type: 3}
--- !u!4 &479263793
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 479263791}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 238320196}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &583502370
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 583502374}
- component: {fileID: 583502373}
- component: {fileID: 583502372}
- component: {fileID: 583502371}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &583502371
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 583502370}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0603bf64edb4c8885cefbc40ee206fe, type: 3}
m_Name:
m_EditorClassIdentifier:
panel: {fileID: 583502370}
--- !u!23 &583502372
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 583502370}
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: a8f5d1054ef74a44b9ad9a606a412c6a, 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 &583502373
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 583502370}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &583502374
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 583502370}
m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071068}
m_LocalPosition: {x: -12.72, y: 0, z: 22.9}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 238320196}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!1 &839221370
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 839221371}
- component: {fileID: 839221373}
- component: {fileID: 839221372}
- component: {fileID: 839221375}
- component: {fileID: 839221374}
m_Layer: 0
m_Name: RightHandTracker
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &839221371
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 839221370}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -3, z: 0}
m_LocalScale: {x: 0.6, y: 0.6, z: 0.6}
m_Children: []
m_Father: {fileID: 238320196}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &839221372
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 839221370}
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 &839221373
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 839221370}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &839221374
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 839221370}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c728061aa76161440af080a260af7610, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &839221375
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 839221370}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f0683062e5364e844be1f76dd7bb5fd7, type: 3}
m_Name:
m_EditorClassIdentifier:
bodyId: 0
jointType: 11
JointDataReceived:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 839221374}
m_MethodName: OnJointDataReceived
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &1931119204
GameObject:
m_ObjectHideFlags: 0
@ -300,8 +561,8 @@ MonoBehaviour:
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}
clearColorMode: 1
backgroundColorHDR: {r: 0, g: 0, b: 0, a: 0}
clearDepth: 1
volumeLayerMask:
serializedVersion: 2

View file

@ -0,0 +1,12 @@
using UnityEngine;
namespace cylvester
{
public class RightHandMarker : MonoBehaviour
{
public void OnJointDataReceived(Windows.Kinect.Joint joint)
{
transform.position = new Vector3(joint.Position.X * 10f, joint.Position.Y * 10f, joint.Position.Z * 10f);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c728061aa76161440af080a260af7610
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -20,7 +20,7 @@ namespace cylvester
}
}
public void OnSkeletonFrameReceived(Body body, int id)
public void OnSkeletonDataReceived(Body body, int id)
{
var i = 0;
foreach(var pair in body.Joints)
@ -31,7 +31,7 @@ namespace cylvester
else
{
balls_[i].SetActive(true);
balls_[i].transform.position = new Vector3(joint.Position.X * 10f , joint.Position.Y * 10f, 0f);
balls_[i].transform.position = new Vector3(joint.Position.X * 10f , joint.Position.Y * 10f, joint.Position.Z *10f);
}
i++;
}

View file

@ -0,0 +1,32 @@
using System;
using Windows.Kinect;
using UnityEngine;
using UnityEngine.Events;
namespace cylvester
{
[Serializable] class UnityJointEvent : UnityEvent<Windows.Kinect.Joint> { }
public class KinectJointBind : MonoBehaviour
{
[SerializeField, Range(0, 5)] private int bodyId = 0;
[SerializeField] private JointType jointType;
[SerializeField] private UnityJointEvent JointDataReceived;
public void OnSkeletonDataReceived(Body body, int id)
{
if (id != bodyId)
return;
if (!body.IsTracked)
return;
var joint = body.Joints[jointType];
if (joint.TrackingState != TrackingState.Tracked)
return;
JointDataReceived.Invoke(joint);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f0683062e5364e844be1f76dd7bb5fd7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: