From a58e88ab727e00c1a723d0dd12c650df230dcb2c Mon Sep 17 00:00:00 2001 From: ANDREA GARGARO Date: Tue, 10 Sep 2024 13:53:04 +0200 Subject: [PATCH] Fix BatchedMesh import --- src/utils/ExtensionUtilities.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/ExtensionUtilities.js b/src/utils/ExtensionUtilities.js index 8f285a8c2..d87bcfebb 100644 --- a/src/utils/ExtensionUtilities.js +++ b/src/utils/ExtensionUtilities.js @@ -1,13 +1,15 @@ -import { Ray, Matrix4, Mesh, Vector3, BatchedMesh, Sphere, REVISION } from 'three'; +import { Ray, Matrix4, Mesh, Vector3, Sphere, 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.prototype.raycast; +const origBatchedRaycastFunc = BatchedMesh !== null ? BatchedMesh.prototype.raycast : null; const _worldScale = /* @__PURE__ */ new Vector3(); const _mesh = /* @__PURE__ */ new Mesh(); const _batchIntersects = [];