Skip to content

Commit

Permalink
Merge pull request #77 from M3-org/fix-colliders-issue
Browse files Browse the repository at this point in the history
Detect if colliders are defined in spring bones
madjin authored Nov 27, 2023
2 parents e5a6eb1 + b69436f commit d93a286
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/library/VRMExporterv0.js
Original file line number Diff line number Diff line change
@@ -584,14 +584,19 @@ export default class VRMExporterv0 {
const colliderIndices = [];
springBone.colliderGroups.forEach(colliderGroup => {
const springCollider = colliderGroup.colliders[0];
const springParent = springCollider.parent;

const ind = colliderGroups.findIndex(group => group.name === springParent.name);
if (ind != -1){
colliderIndices.push(ind);
// sometimes there are no colliders defined in collidersGroup
if (springCollider != null){
const springParent = springCollider.parent;
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")
}
});

0 comments on commit d93a286

Please sign in to comment.