Skip to content

Commit

Permalink
detect if springbones are defined in spring bones
Browse files Browse the repository at this point in the history
  • Loading branch information
memelotsqui committed Nov 27, 2023
1 parent e5a6eb1 commit 29ca74b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/library/VRMExporterv0.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,14 +584,20 @@ export default class VRMExporterv0 {
const colliderIndices = [];
springBone.colliderGroups.forEach(colliderGroup => {
const springCollider = colliderGroup.colliders[0];
const springParent = springCollider.parent;
// sometimes there is no colliders defined
if (springCollider != null){
const springParent = springCollider.parent;

const ind = colliderGroups.findIndex(group => group.name === springParent.name);
if (ind != -1){
colliderIndices.push(ind);
const ind = colliderGroups.findIndex(group => group.name === springParent.name);
if (ind != -1){
colliderIndices.push(ind);
}
else{
console.warn("No collider group for bone name: ", springParent.name + " was found");
}
}
else{
console.warn("no collider group for bone name: ", springParent.name + " was found");
console.log("No colliders definition were present in vrm file file for: ", springBone.name + " spring bones")
}
});

Expand Down

0 comments on commit 29ca74b

Please sign in to comment.