diff --git a/package.json b/package.json index 6e87adb77..33e059cd0 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ }, "homepage": "https://github.com/gkjohnson/three-mesh-bvh#readme", "peerDependencies": { - "three": ">= 0.151.0" + "three": ">= 0.158.0" }, "devDependencies": { "@babel/core": "^7.15.5", diff --git a/src/utils/ExtensionUtilities.js b/src/utils/ExtensionUtilities.js index d87bcfebb..f734f6f15 100644 --- a/src/utils/ExtensionUtilities.js +++ b/src/utils/ExtensionUtilities.js @@ -1,15 +1,13 @@ -import { Ray, Matrix4, Mesh, Vector3, Sphere, REVISION } from 'three'; +import { Ray, Matrix4, Mesh, Vector3, Sphere, BatchedMesh, REVISION } from 'three'; import { convertRaycastIntersect } from './GeometryRayIntersectUtilities.js'; import { MeshBVH } from '../core/MeshBVH.js'; -import * as THREE from 'three'; -const BatchedMesh = THREE.BatchedMesh || null; // this is necessary to not break three.js r157- const IS_REVISION_166 = parseInt( REVISION ) >= 166; const ray = /* @__PURE__ */ new Ray(); const direction = /* @__PURE__ */ new Vector3(); const tmpInverseMatrix = /* @__PURE__ */ new Matrix4(); const origMeshRaycastFunc = Mesh.prototype.raycast; -const origBatchedRaycastFunc = BatchedMesh !== null ? BatchedMesh.prototype.raycast : null; +const origBatchedRaycastFunc = BatchedMesh.prototype.raycast; const _worldScale = /* @__PURE__ */ new Vector3(); const _mesh = /* @__PURE__ */ new Mesh(); const _batchIntersects = [];