Skip to content

Instantly share code, notes, and snippets.

@neon-izm
Created September 17, 2018 02:36
Show Gist options
  • Save neon-izm/0637dac7a29682de916cecc0e8b037b0 to your computer and use it in GitHub Desktop.
Save neon-izm/0637dac7a29682de916cecc0e8b037b0 to your computer and use it in GitHub Desktop.
HumanPose.musclesの中身の95個のfloatはこんな感じ。55から94に指の情報が入っている
0 Spine Front-Back
1 Spine Left-Right
2 Spine Twist Left-Right
3 Chest Front-Back
4 Chest Left-Right
5 Chest Twist Left-Right
6 UpperChest Front-Back
7 UpperChest Left-Right
8 UpperChest Twist Left-Right
9 Neck Nod Down-Up
10 Neck Tilt Left-Right
11 Neck Turn Left-Right
12 Head Nod Down-Up
13 Head Tilt Left-Right
14 Head Turn Left-Right
15 Left Eye Down-Up
16 Left Eye In-Out
17 Right Eye Down-Up
18 Right Eye In-Out
19 Jaw Close
20 Jaw Left-Right
21 Left Upper Leg Front-Back
22 Left Upper Leg In-Out
23 Left Upper Leg Twist In-Out
24 Left Lower Leg Stretch
25 Left Lower Leg Twist In-Out
26 Left Foot Up-Down
27 Left Foot Twist In-Out
28 Left Toes Up-Down
29 Right Upper Leg Front-Back
30 Right Upper Leg In-Out
31 Right Upper Leg Twist In-Out
32 Right Lower Leg Stretch
33 Right Lower Leg Twist In-Out
34 Right Foot Up-Down
35 Right Foot Twist In-Out
36 Right Toes Up-Down
37 Left Shoulder Down-Up
38 Left Shoulder Front-Back
39 Left Arm Down-Up
40 Left Arm Front-Back
41 Left Arm Twist In-Out
42 Left Forearm Stretch
43 Left Forearm Twist In-Out
44 Left Hand Down-Up
45 Left Hand In-Out
46 Right Shoulder Down-Up
47 Right Shoulder Front-Back
48 Right Arm Down-Up
49 Right Arm Front-Back
50 Right Arm Twist In-Out
51 Right Forearm Stretch
52 Right Forearm Twist In-Out
53 Right Hand Down-Up
54 Right Hand In-Out
55 Left Thumb 1 Stretched
56 Left Thumb Spread
57 Left Thumb 2 Stretched
58 Left Thumb 3 Stretched
59 Left Index 1 Stretched
60 Left Index Spread
61 Left Index 2 Stretched
62 Left Index 3 Stretched
63 Left Middle 1 Stretched
64 Left Middle Spread
65 Left Middle 2 Stretched
66 Left Middle 3 Stretched
67 Left Ring 1 Stretched
68 Left Ring Spread
69 Left Ring 2 Stretched
70 Left Ring 3 Stretched
71 Left Little 1 Stretched
72 Left Little Spread
73 Left Little 2 Stretched
74 Left Little 3 Stretched
75 Right Thumb 1 Stretched
76 Right Thumb Spread
77 Right Thumb 2 Stretched
78 Right Thumb 3 Stretched
79 Right Index 1 Stretched
80 Right Index Spread
81 Right Index 2 Stretched
82 Right Index 3 Stretched
83 Right Middle 1 Stretched
84 Right Middle Spread
85 Right Middle 2 Stretched
86 Right Middle 3 Stretched
87 Right Ring 1 Stretched
88 Right Ring Spread
89 Right Ring 2 Stretched
90 Right Ring 3 Stretched
91 Right Little 1 Stretched
92 Right Little Spread
93 Right Little 2 Stretched
94 Right Little 3 Stretched
@neon-izm
Copy link
Author

muscle芸をやるときの注意点を頂いたのでメモ

HumanPoseHandlerは持ち回りせずにusingしないとクラッシュの危険性があります。エディタ拡張だけでなく、ランタイムでキャラクターが動的にRespawnするときも同様の注意が必要

https://twitter.com/TyounanMOTI/status/1041572253048070145

中手骨があるモデルの場合、指が真っ直ぐきれいに曲がらない?現象も確認してます。どうやら第一関節から先のローカル座標空間ではなく、手首から先のローカル座標空間で曲げている?らしく、妙な曲がり方をします

https://twitter.com/TyounanMOTI/status/1041570728196243456

Avatarのボーンにスケールが入っていたり、Scene上でAnimatorの付いているTransformにスケール値が入っていたりすると、Get/SetHumanPoseしたときにHipが吹っ飛んでいく現象がある

https://twitter.com/TyounanMOTI/status/1041568754839183360

@neon-izm
Copy link
Author

neon-izm commented Apr 4, 2025

HumanTraitのBoneNameとGetBoneTransformの引数のenum、さらにOptitrackの骨格名が全部微妙に違ったのでまとめておきました

日本語 HumanTrait.BoneName(Mecanim) HumanBodyBones(GetBoneTransform) OptiTrack骨格名
Hips Hips Hips
背骨 Spine Spine Spine
Chest Chest Spine1
上胸 UpperChest UpperChest Spine2
Neck Neck Neck
Head Head Head
左肩 LeftShoulder LeftShoulder LeftShoulder
左上腕 LeftUpperArm LeftUpperArm LeftArm
左肘(下腕) LeftLowerArm LeftLowerArm LeftForeArm
左手首 LeftHand LeftHand LeftHand
右肩 RightShoulder RightShoulder RightShoulder
右上腕 RightUpperArm RightUpperArm RightArm
右肘(下腕) RightLowerArm RightLowerArm RightForeArm
右手首 RightHand RightHand RightHand
左太もも LeftUpperLeg LeftUpperLeg LeftUpLeg
左膝(下脚) LeftLowerLeg LeftLowerLeg LeftLeg
左足首 LeftFoot LeftFoot LeftFoot
左つま先 LeftToes LeftToes LeftToeBase
右太もも RightUpperLeg RightUpperLeg RightUpLeg
右膝(下脚) RightLowerLeg RightLowerLeg RightLeg
右足首 RightFoot RightFoot RightFoot
右つま先 RightToes RightToes RightToeBase
左親指第1関節 Left Thumb Proximal LeftThumbProximal LeftHandThumb1
左親指第2関節 Left Thumb Intermediate LeftThumbIntermediate LeftHandThumb2
左親指第3関節 Left Thumb Distal LeftThumbDistal LeftHandThumb3
左人差し指第1関節 Left Index Proximal LeftIndexProximal LeftHandIndex1
左人差し指第2関節 Left Index Intermediate LeftIndexIntermediate LeftHandIndex2
左人差し指第3関節 Left Index Distal LeftIndexDistal LeftHandIndex3
左中指第1関節 Left Middle Proximal LeftMiddleProximal LeftHandMiddle1
左中指第2関節 Left Middle Intermediate LeftMiddleIntermediate LeftHandMiddle2
左中指第3関節 Left Middle Distal LeftMiddleDistal LeftHandMiddle3
左薬指第1関節 Left Ring Proximal LeftRingProximal LeftHandRing1
左薬指第2関節 Left Ring Intermediate LeftRingIntermediate LeftHandRing2
左薬指第3関節 Left Ring Distal LeftRingDistal LeftHandRing3
左小指第1関節 Left Little Proximal LeftLittleProximal LeftHandPinky1
左小指第2関節 Left Little Intermediate LeftLittleIntermediate LeftHandPinky2
左小指第3関節 Left Little Distal LeftLittleDistal LeftHandPinky3
右親指第1関節 Right Thumb Proximal RightThumbProximal RightHandThumb1
右親指第2関節 Right Thumb Intermediate RightThumbIntermediate RightHandThumb2
右親指第3関節 Right Thumb Distal RightThumbDistal RightHandThumb3
右人差し指第1関節 Right Index Proximal RightIndexProximal RightHandIndex1
右人差し指第2関節 Right Index Intermediate RightIndexIntermediate RightHandIndex2
右人差し指第3関節 Right Index Distal RightIndexDistal RightHandIndex3
右中指第1関節 Right Middle Proximal RightMiddleProximal RightHandMiddle1
右中指第2関節 Right Middle Intermediate RightMiddleIntermediate RightHandMiddle2
右中指第3関節 Right Middle Distal RightMiddleDistal RightHandMiddle3
右薬指第1関節 Right Ring Proximal RightRingProximal RightHandRing1
右薬指第2関節 Right Ring Intermediate RightRingIntermediate RightHandRing2
右薬指第3関節 Right Ring Distal RightRingDistal RightHandRing3
右小指第1関節 Right Little Proximal RightLittleProximal RightHandPinky1
右小指第2関節 Right Little Intermediate RightLittleIntermediate RightHandPinky2
右小指第3関節 Right Little Distal RightLittleDistal RightHandPinky3
左目 LeftEye LeftEye -
右目 RightEye RightEye -
Jaw Jaw -

@neon-izm
Copy link
Author

neon-izm commented Apr 4, 2025

こんな感じの辞書を作っておくと、便利

    public static readonly Dictionary<string, HumanBodyBones> BoneNameToHumanBodyBones = new Dictionary<string, HumanBodyBones>
    {
        { "Hips", HumanBodyBones.Hips },
        { "LeftUpperLeg", HumanBodyBones.LeftUpperLeg },
        { "RightUpperLeg", HumanBodyBones.RightUpperLeg },
        { "LeftLowerLeg", HumanBodyBones.LeftLowerLeg },
        { "RightLowerLeg", HumanBodyBones.RightLowerLeg },
        { "LeftFoot", HumanBodyBones.LeftFoot },
        { "RightFoot", HumanBodyBones.RightFoot },
        { "Spine", HumanBodyBones.Spine },
        { "Chest", HumanBodyBones.Chest },
        { "Neck", HumanBodyBones.Neck },
        { "Head", HumanBodyBones.Head },
        { "LeftShoulder", HumanBodyBones.LeftShoulder },
        { "RightShoulder", HumanBodyBones.RightShoulder },
        { "LeftUpperArm", HumanBodyBones.LeftUpperArm },
        { "RightUpperArm", HumanBodyBones.RightUpperArm },
        { "LeftLowerArm", HumanBodyBones.LeftLowerArm },
        { "RightLowerArm", HumanBodyBones.RightLowerArm },
        { "LeftHand", HumanBodyBones.LeftHand },
        { "RightHand", HumanBodyBones.RightHand },
        { "LeftToes", HumanBodyBones.LeftToes },
        { "RightToes", HumanBodyBones.RightToes },
        { "LeftEye", HumanBodyBones.LeftEye },
        { "RightEye", HumanBodyBones.RightEye },
        { "Jaw", HumanBodyBones.Jaw },
        { "Left Thumb Proximal", HumanBodyBones.LeftThumbProximal },
        { "Left Thumb Intermediate", HumanBodyBones.LeftThumbIntermediate },
        { "Left Thumb Distal", HumanBodyBones.LeftThumbDistal },
        { "Left Index Proximal", HumanBodyBones.LeftIndexProximal },
        { "Left Index Intermediate", HumanBodyBones.LeftIndexIntermediate },
        { "Left Index Distal", HumanBodyBones.LeftIndexDistal },
        { "Left Middle Proximal", HumanBodyBones.LeftMiddleProximal },
        { "Left Middle Intermediate", HumanBodyBones.LeftMiddleIntermediate },
        { "Left Middle Distal", HumanBodyBones.LeftMiddleDistal },
        { "Left Ring Proximal", HumanBodyBones.LeftRingProximal },
        { "Left Ring Intermediate", HumanBodyBones.LeftRingIntermediate },
        { "Left Ring Distal", HumanBodyBones.LeftRingDistal },
        { "Left Little Proximal", HumanBodyBones.LeftLittleProximal },
        { "Left Little Intermediate", HumanBodyBones.LeftLittleIntermediate },
        { "Left Little Distal", HumanBodyBones.LeftLittleDistal },
        { "Right Thumb Proximal", HumanBodyBones.RightThumbProximal },
        { "Right Thumb Intermediate", HumanBodyBones.RightThumbIntermediate },
        { "Right Thumb Distal", HumanBodyBones.RightThumbDistal },
        { "Right Index Proximal", HumanBodyBones.RightIndexProximal },
        { "Right Index Intermediate", HumanBodyBones.RightIndexIntermediate },
        { "Right Index Distal", HumanBodyBones.RightIndexDistal },
        { "Right Middle Proximal", HumanBodyBones.RightMiddleProximal },
        { "Right Middle Intermediate", HumanBodyBones.RightMiddleIntermediate },
        { "Right Middle Distal", HumanBodyBones.RightMiddleDistal },
        { "Right Ring Proximal", HumanBodyBones.RightRingProximal },
        { "Right Ring Intermediate", HumanBodyBones.RightRingIntermediate },
        { "Right Ring Distal", HumanBodyBones.RightRingDistal },
        { "Right Little Proximal", HumanBodyBones.RightLittleProximal },
        { "Right Little Intermediate", HumanBodyBones.RightLittleIntermediate },
        { "Right Little Distal", HumanBodyBones.RightLittleDistal },
        { "UpperChest", HumanBodyBones.UpperChest }
    };
    
    
    public static readonly Dictionary<HumanBodyBones, string> HumanBodyBonesToBoneName = new Dictionary<HumanBodyBones, string>
    {
        { HumanBodyBones.Hips, "Hips" },
        { HumanBodyBones.LeftUpperLeg, "LeftUpperLeg" },
        { HumanBodyBones.RightUpperLeg, "RightUpperLeg" },
        { HumanBodyBones.LeftLowerLeg, "LeftLowerLeg" },
        { HumanBodyBones.RightLowerLeg, "RightLowerLeg" },
        { HumanBodyBones.LeftFoot, "LeftFoot" },
        { HumanBodyBones.RightFoot, "RightFoot" },
        { HumanBodyBones.Spine, "Spine" },
        { HumanBodyBones.Chest, "Chest" },
        { HumanBodyBones.Neck, "Neck" },
        { HumanBodyBones.Head, "Head" },
        { HumanBodyBones.LeftShoulder, "LeftShoulder" },
        { HumanBodyBones.RightShoulder, "RightShoulder" },
        { HumanBodyBones.LeftUpperArm, "LeftUpperArm" },
        { HumanBodyBones.RightUpperArm, "RightUpperArm" },
        { HumanBodyBones.LeftLowerArm, "LeftLowerArm" },
        { HumanBodyBones.RightLowerArm, "RightLowerArm" },
        { HumanBodyBones.LeftHand, "LeftHand" },
        { HumanBodyBones.RightHand, "RightHand" },
        { HumanBodyBones.LeftToes, "LeftToes" },
        { HumanBodyBones.RightToes, "RightToes" },
        { HumanBodyBones.LeftEye, "LeftEye" },
        { HumanBodyBones.RightEye, "RightEye" },
        { HumanBodyBones.Jaw, "Jaw" },
        { HumanBodyBones.LeftThumbProximal, "Left Thumb Proximal" },
        { HumanBodyBones.LeftThumbIntermediate, "Left Thumb Intermediate" },
        { HumanBodyBones.LeftThumbDistal, "Left Thumb Distal" },
        { HumanBodyBones.LeftIndexProximal, "Left Index Proximal" },
        { HumanBodyBones.LeftIndexIntermediate, "Left Index Intermediate" },
        { HumanBodyBones.LeftIndexDistal, "Left Index Distal" },
        { HumanBodyBones.LeftMiddleProximal, "Left Middle Proximal" },
        { HumanBodyBones.LeftMiddleIntermediate, "Left Middle Intermediate" },
        { HumanBodyBones.LeftMiddleDistal, "Left Middle Distal" },
        { HumanBodyBones.LeftRingProximal, "Left Ring Proximal" },
        { HumanBodyBones.LeftRingIntermediate, "Left Ring Intermediate" },
        { HumanBodyBones.LeftRingDistal, "Left Ring Distal" },
        { HumanBodyBones.LeftLittleProximal, "Left Little Proximal" },
        { HumanBodyBones.LeftLittleIntermediate, "Left Little Intermediate" },
        { HumanBodyBones.LeftLittleDistal, "Left Little Distal" },
        { HumanBodyBones.RightThumbProximal, "Right Thumb Proximal" },
        { HumanBodyBones.RightThumbIntermediate, "Right Thumb Intermediate" },
        { HumanBodyBones.RightThumbDistal, "Right Thumb Distal" },
        { HumanBodyBones.RightIndexProximal, "Right Index Proximal" },
        { HumanBodyBones.RightIndexIntermediate, "Right Index Intermediate" },
        { HumanBodyBones.RightIndexDistal, "Right Index Distal" },
        { HumanBodyBones.RightMiddleProximal, "Right Middle Proximal" },
        { HumanBodyBones.RightMiddleIntermediate, "Right Middle Intermediate" },
        { HumanBodyBones.RightMiddleDistal, "Right Middle Distal" },
        { HumanBodyBones.RightRingProximal, "Right Ring Proximal" },
        { HumanBodyBones.RightRingIntermediate, "Right Ring Intermediate" },
        { HumanBodyBones.RightRingDistal, "Right Ring Distal" },
        { HumanBodyBones.RightLittleProximal, "Right Little Proximal" },
        { HumanBodyBones.RightLittleIntermediate, "Right Little Intermediate" },
        { HumanBodyBones.RightLittleDistal, "Right Little Distal" },
        { HumanBodyBones.UpperChest, "UpperChest" }
    };
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment