diff --git a/src/core/MeshBVH.js b/src/core/MeshBVH.js index 05fd6c2d..a41596a4 100644 --- a/src/core/MeshBVH.js +++ b/src/core/MeshBVH.js @@ -157,7 +157,7 @@ export class MeshBVH { this._roots = null; if ( ! options[ SKIP_GENERATION ] ) { - this._roots = buildPackedTree( geometry, options ); + buildPackedTree( geometry, options, this ); if ( ! geometry.boundingBox && options.setBoundingBox ) { diff --git a/src/core/build/buildTree.js b/src/core/build/buildTree.js index 38e675d3..b9574199 100644 --- a/src/core/build/buildTree.js +++ b/src/core/build/buildTree.js @@ -142,7 +142,7 @@ function buildTree( geo, options ) { } -export function buildPackedTree( geo, options ) { +export function buildPackedTree( geo, options, target ) { // boundingData : 6 float32 // right / offset : 1 uint32 @@ -168,7 +168,8 @@ export function buildPackedTree( geo, options ) { } - return packedRoots; + target._roots = packedRoots; + return; function countNodes( node ) {