Skip to content

Commit

Permalink
add shoulders in case not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
memelotsqui committed Nov 3, 2023
1 parent 44b325f commit c50cc27
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/library/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,29 @@ export const renameVRMBones = (vrm) => {
}
}
}

// same ase before, left and right shoulder are optional vrm bones, make sure that if they are missing they are not included
if (bones ['leftShoulder'] == null){
if (bones['leftUpperArm'].node.parent != bones['chest']?.node &&
bones['leftUpperArm'].node.parent != bones['upperChest']?.node &&
bones['leftUpperArm'].node.parent != bones['spine']?.node &&
bones['leftUpperArm'].node.parent != bones['neck']?.node &&
bones['leftUpperArm'].node.parent != bones['head']?.node ){
}{
bones['leftShoulder'] = {node:bones['leftUpperArm'].node.parent}
}
}

if (bones ['rightShoulder'] == null){
if (bones['rightUpperArm'].node.parent != bones['chest']?.node &&
bones['rightUpperArm'].node.parent != bones['upperChest']?.node &&
bones['rightUpperArm'].node.parent != bones['spine']?.node &&
bones['rightUpperArm'].node.parent != bones['neck']?.node &&
bones['rightUpperArm'].node.parent != bones['head']?.node ){
}{
bones['rightShoulder'] = {node:bones['rightUpperArm'].node.parent}
}
}

for (let boneName in VRMHumanBoneName) {
boneName = boneName.charAt(0).toLowerCase() + boneName.slice(1)
Expand Down

0 comments on commit c50cc27

Please sign in to comment.