Skip to content

Commit

Permalink
fix: handle Matrix4 getInverse deprecation in three r123
Browse files Browse the repository at this point in the history
  • Loading branch information
samalexander committed Dec 13, 2020
1 parent b40b1a0 commit d04eb4b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ export class CSG {
geom.faces.push(fc);
}
}
const inv = new Matrix4().getInverse(toMatrix);
let inv: any;
// test for matrix invert method introduced in r123
if (typeof toMatrix['invert'] === 'function') {
inv = toMatrix.invert();
} else {
// enables compatibility with previous versions
inv = new Matrix4().getInverse(toMatrix);
}
geom.applyMatrix4(inv);
geom.verticesNeedUpdate = geom.elementsNeedUpdate = geom.normalsNeedUpdate = true;
geom.computeBoundingSphere();
Expand Down

0 comments on commit d04eb4b

Please sign in to comment.