Skip to content

Commit 15e452c

Browse files
author
Avaer Kazmer
committed
Add armature lookup in Rig.js
1 parent 892e2ee commit 15e452c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

vrarmik/Rig.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -246,17 +246,15 @@ class Rig {
246246
};
247247
this.modelBones = modelBones;
248248

249-
/* model.traverse(o => {
250-
if (o.isSkinnedMesh) {
251-
for (const k in modelBones) {
252-
if (!modelBones[k]) {
253-
const userlandBoneName = boneMappings[k];
254-
modelBones[k] = skeleton.bones.find(bone => bone.name === userlandBoneName);
255-
console.log('found bone', k, userlandBoneName, modelBones[k], modelBones[k] && modelBones[k].children);
256-
}
257-
}
258-
}
259-
}); */
249+
const _findArmature = bone => {
250+
for (; bone; bone = bone.parent) {
251+
if (!bone.isBone) {
252+
return bone;
253+
}
254+
}
255+
return null;
256+
};
257+
const armature = _findArmature(Hips);
260258

261259
const eyeDirection = modelBones.Eye_L.getWorldPosition(new Vector3()).sub(modelBones.Head.getWorldPosition(new Vector3()));
262260
const flipZ = eyeDirection.z < 0;

0 commit comments

Comments
 (0)