Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
ButtonPusher
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Button Pusher
ButtonPusher
Commits
31681324
Commit
31681324
authored
7 years ago
by
16이상민
Committed by
rightright
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
모션 모두 추가
parent
6e0695fb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
119 additions
and
17 deletions
+119
-17
KinectUnityAddin.dll
Assets/Plugins/Metro/KinectUnityAddin.dll
+0
-0
KinectUnityAddin.dll.meta
Assets/Plugins/Metro/KinectUnityAddin.dll.meta
+0
-1
KinectUnityAddin.dll
Assets/Plugins/x86/KinectUnityAddin.dll
+0
-0
KinectUnityAddin.dll.meta
Assets/Plugins/x86/KinectUnityAddin.dll.meta
+0
-1
KinectUnityAddin.dll
Assets/Plugins/x86_64/KinectUnityAddin.dll
+0
-0
KinectUnityAddin.dll.meta
Assets/Plugins/x86_64/KinectUnityAddin.dll.meta
+0
-1
MotionView.cs
Assets/Script/MotionView.cs
+119
-14
No files found.
Assets/Plugins/Metro/KinectUnityAddin.dll
0 → 100644
View file @
31681324
File added
This diff is collapsed.
Click to expand it.
Assets/Plugins/Metro/KinectUnityAddin.dll.meta
View file @
31681324
fileFormatVersion: 2
guid: 85bafbe9b14b18b45b445b304b1f3efc
timeCreated: 18446744011573954816
PluginImporter:
serializedVersion: 2
iconMap: {}
...
...
This diff is collapsed.
Click to expand it.
Assets/Plugins/x86/KinectUnityAddin.dll
0 → 100644
View file @
31681324
File added
This diff is collapsed.
Click to expand it.
Assets/Plugins/x86/KinectUnityAddin.dll.meta
View file @
31681324
fileFormatVersion: 2
guid: b65facb0c9c68b647b8ca7435b5f35c4
timeCreated: 18446744011573954816
PluginImporter:
serializedVersion: 2
iconMap: {}
...
...
This diff is collapsed.
Click to expand it.
Assets/Plugins/x86_64/KinectUnityAddin.dll
0 → 100644
View file @
31681324
File added
This diff is collapsed.
Click to expand it.
Assets/Plugins/x86_64/KinectUnityAddin.dll.meta
View file @
31681324
fileFormatVersion: 2
guid: 82e143d16729051459ae6a54b37e9eab
timeCreated: 18446744011573954816
PluginImporter:
serializedVersion: 2
iconMap: {}
...
...
This diff is collapsed.
Click to expand it.
Assets/Script/MotionView.cs
View file @
31681324
...
...
@@ -10,6 +10,12 @@ public class MotionView : MonoBehaviour {
public
GameObject
CoordinateMapperManager
;
CoordinateMapperManager
_coordinateMapperManager
;
Body
[]
body
;
CameraSpacePoint
spineMidRecent
,
handLeftRecent
,
handRightRecent
,
kneeLeftBase
,
kneeRightBase
;
bool
IsInitialized
;
// Use this for initialization
void
Start
()
{
...
...
@@ -25,6 +31,8 @@ public class MotionView : MonoBehaviour {
=
CoordinateMapperManager
.
GetComponent
<
CoordinateMapperManager
>();
body
=
_coordinateMapperManager
.
GetBodyBuffer
();
IsInitialized
=
false
;
}
// Update is called once per frame
...
...
@@ -38,7 +46,10 @@ public class MotionView : MonoBehaviour {
MotionState
DetermineState
()
{
if
(
body
==
null
)
return
MotionState
.
UNKNOWN
;
{
IsInitialized
=
false
;
return
MotionState
.
UNKNOWN
;
}
int
idx
;
for
(
idx
=
0
;
idx
<
body
.
Length
;
++
idx
)
...
...
@@ -47,26 +58,104 @@ public class MotionView : MonoBehaviour {
if
(
idx
==
body
.
Length
||
body
[
idx
].
Joints
==
null
)
return
MotionState
.
UNKNOWN
;
CameraSpacePoint
head
=
body
[
idx
].
Joints
[
JointType
.
Head
]
if
(!
IsInitialized
)
{
kneeLeftBase
=
body
[
idx
].
Joints
[
JointType
.
KneeLeft
].
Position
;
kneeRightBase
=
body
[
idx
].
Joints
[
JointType
.
KneeRight
].
Position
;
}
IsInitialized
=
true
;
CameraSpacePoint
head
=
body
[
idx
].
Joints
[
JointType
.
Head
]
.
Position
,
leftHand
=
body
[
idx
].
Joints
[
JointType
.
HandLeft
]
handLeft
=
body
[
idx
].
Joints
[
JointType
.
HandLeft
]
.
Position
,
rightHand
=
body
[
idx
].
Joints
[
JointType
.
HandRight
]
handRight
=
body
[
idx
].
Joints
[
JointType
.
HandRight
]
.
Position
,
spineShoulder
=
body
[
idx
].
Joints
[
JointType
.
SpineShoulder
]
.
Position
,
spineMid
=
body
[
idx
].
Joints
[
JointType
.
SpineMid
]
.
Position
,
elbowLeft
=
body
[
idx
].
Joints
[
JointType
.
ElbowLeft
]
.
Position
,
elbowRight
=
body
[
idx
].
Joints
[
JointType
.
ElbowRight
]
.
Position
,
kneeLeft
=
body
[
idx
].
Joints
[
JointType
.
KneeLeft
]
.
Position
,
kneeRight
=
body
[
idx
].
Joints
[
JointType
.
KneeRight
]
.
Position
;
MotionState
s
=
MotionState
.
UNKNOWN
;
if
(
head
.
Y
<
leftHand
.
Y
&&
head
.
Y
<
rightHand
.
Y
)
s
|=
MotionState
.
HURRAY
;
if
(
Distance
(
leftHand
,
rightHand
)
>
0.3f
&&
spineShoulder
.
Y
<
leftHand
.
Y
&&
spineShoulder
.
Y
<
rightHand
.
Y
)
// Clap
if
(
Distance
(
handLeft
,
handRight
)
>
0.3f
&&
spineShoulder
.
Y
<
handLeft
.
Y
&&
spineShoulder
.
Y
<
handRight
.
Y
)
s
|=
MotionState
.
CLAP_PREPARE
;
if
(
Distance
(
leftHand
,
rightHand
)
<
0.1f
&&
spineShoulder
.
Y
<
leftHand
.
Y
&&
spineShoulder
.
Y
<
rightHand
.
Y
)
if
(
Distance
(
handLeft
,
handRight
)
<
0.1f
&&
spineShoulder
.
Y
<
handLeft
.
Y
&&
spineShoulder
.
Y
<
handRight
.
Y
)
s
|=
MotionState
.
CLAP_DONE
;
// Jump
if
(
spineMid
.
Y
-
spineMidRecent
.
Y
<
0.05f
)
s
|=
MotionState
.
JUMP_PREPARE
;
if
(
spineMid
.
Y
>
spineMidRecent
.
Y
)
s
|=
MotionState
.
JUMP_DONE
;
// Push Up
if
(
head
.
Y
<
handLeft
.
Y
&&
head
.
Y
<
handRight
.
Y
)
s
|=
MotionState
.
HURRAY
;
if
(
handLeft
.
Y
-
handLeftRecent
.
Y
>
0
)
s
|=
MotionState
.
HAND_MOVE_UP_LEFT
;
if
(
handLeft
.
Y
-
handLeftRecent
.
Y
<
0
)
s
|=
MotionState
.
HAND_MOVE_DOWN_LEFT
;
if
(
handRight
.
Y
-
handRightRecent
.
Y
>
0
)
s
|=
MotionState
.
HAND_MOVE_UP_RIGHT
;
if
(
handRight
.
Y
-
handRightRecent
.
Y
<
0
)
s
|=
MotionState
.
HAND_MOVE_DOWN_RIGHT
;
// Guard
if
(
handLeft
.
Y
>
elbowLeft
.
Y
&&
Mathf
.
Abs
(
elbowLeft
.
X
-
spineMid
.
X
)
<
0.5f
)
s
|=
MotionState
.
GUARD_BASE_LEFT
;
if
(
handRight
.
Y
>
elbowRight
.
Y
&&
Mathf
.
Abs
(
elbowRight
.
X
-
spineMid
.
X
)
<
0.5f
)
s
|=
MotionState
.
GUARD_BASE_RIGHT
;
// Hand Up
if
(
handLeft
.
Y
-
head
.
Y
>
0.2
)
s
|=
MotionState
.
HAND_UP_LEFT
;
if
(
handRight
.
Y
-
head
.
Y
>
0.2
)
s
|=
MotionState
.
HAND_UP_RIGHT
;
// Hand Down
if
(
handLeft
.
Y
<
spineMid
.
Y
)
s
|=
MotionState
.
HAND_DOWN_LEFT
;
if
(
handRight
.
Y
>
spineMid
.
Y
)
s
|=
MotionState
.
HAND_DOWN_RIGHT
;
// Jesus
if
(
Mathf
.
Min
(
handLeft
.
Y
,
handRight
.
Y
)
>
spineShoulder
.
Y
&&
Mathf
.
Abs
(
handLeft
.
X
-
head
.
X
)
>=
0.5f
&&
Mathf
.
Abs
(
handRight
.
X
-
head
.
X
)
>=
0.5f
)
s
|=
MotionState
.
JESUS
;
// Headphone
if
(
Mathf
.
Abs
(
handLeft
.
X
-
head
.
X
)
<
0.2f
&&
Mathf
.
Abs
(
handLeft
.
Z
-
head
.
Z
)
<
0.2f
)
s
|=
MotionState
.
HEADPHONE_LEFT
;
if
(
Mathf
.
Abs
(
handRight
.
X
-
head
.
X
)
<
0.2f
&&
Mathf
.
Abs
(
handRight
.
Z
-
head
.
Z
)
<
0.2f
)
s
|=
MotionState
.
HEADPHONE_RIGHT
;
// On The Table
if
(
kneeLeft
.
Y
-
kneeLeftBase
.
Y
>=
0.5f
||
kneeRight
.
Y
-
kneeRightBase
.
Y
>=
0.5f
)
s
|=
MotionState
.
ON_THE_TABLE
;
InputManager
.
Instance
.
Joints
=
body
[
idx
].
Joints
;
spineMidRecent
=
spineMid
;
handLeftRecent
=
handLeft
;
handRightRecent
=
handRight
;
return
s
;
}
...
...
@@ -87,10 +176,26 @@ public class MotionView : MonoBehaviour {
[
System
.
Flags
]
public
enum
MotionState
:
uint
{
UNKNOWN
=
0
,
CLAP_PREPARE
=
1
,
CLAP_DONE
=
2
,
HURRAY
=
4
UNKNOWN
=
0x00000
,
CLAP_PREPARE
=
0x00001
,
CLAP_DONE
=
0x00002
,
JUMP_PREPARE
=
0x00004
,
JUMP_DONE
=
0x00008
,
HURRAY
=
0x00010
,
HAND_MOVE_UP_LEFT
=
0x00020
,
HAND_MOVE_DOWN_LEFT
=
0x00040
,
HAND_MOVE_UP_RIGHT
=
0x00080
,
HAND_MOVE_DOWN_RIGHT
=
0x00100
,
GUARD_BASE_LEFT
=
0x00200
,
GUARD_BASE_RIGHT
=
0x00400
,
HAND_UP_LEFT
=
0x00800
,
HAND_DOWN_LEFT
=
0x01000
,
HAND_UP_RIGHT
=
0x02000
,
HAND_DOWN_RIGHT
=
0x04000
,
JESUS
=
0x10000
,
HEADPHONE_LEFT
=
0x20000
,
HEADPHONE_RIGHT
=
0x40000
,
ON_THE_TABLE
=
0x80000
}
public
class
Pair
<
T1
,
T2
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment