Skip to content

Commit

Permalink
Merge pull request #41 from Elettrotecnica/master
Browse files Browse the repository at this point in the history
Handle the case where mesh2shape returns null
  • Loading branch information
diarmidmackenzie committed Aug 30, 2023
2 parents 0253cbe + 92ca1a1 commit ea1630d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/body/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,17 @@ var Body = {
type: ShapeType[data.shape.toUpperCase()]
});

var { shape, offset, orientation } = mesh2shape(this.el.object3D, options);
const shapeInfo = mesh2shape(this.el.object3D, options);
let shape, offset, orientation;
if (shapeInfo) {
({ shape, offset, orientation } = shapeInfo);
}

if (!shape) {
el.addEventListener('object3dset', this.initBody.bind(this));
return;
}

this.body.addShape(shape, offset, orientation);

// Show wireframe
Expand Down

0 comments on commit ea1630d

Please sign in to comment.