extendsGroup
A THREE.Group that visualizes a BVH as wireframe bounding boxes or solid
face overlays. Attach it as a sibling of the mesh in the scene graph and
call update() whenever the mesh's BVH or world transform changes.
import { Mesh, TorusKnotGeometry, MeshNormalMaterial } from 'three';
import { MeshBVH, BVHHelper } from 'three-mesh-bvh';
// scene, camera and renderer are initialized here
const mesh = new Mesh( new TorusKnotGeometry( 1, 0.3, 200, 30 ), new MeshNormalMaterial() );
mesh.geometry.boundsTree = new MeshBVH( mesh.geometry );
const helper = new BVHHelper( mesh, 10 );
helper.traverse( object => object.frustumCulled = false );
scene.add( mesh, helper );On this page
Properties
Shortcut to edgeMaterial.color.
opacity: number
Opacity applied to both edge and mesh materials.
depth: number
bvh: GeometryBVH | null
displayParents: boolean
displayEdges: boolean
instanceId: number
Material used when rendering in wireframe edge mode.
Material used when rendering in solid face mode.
Methods
new BVHHelper(
// The mesh whose `geometry.boundsTree` should be displayed, or a `GeometryBVH` to display directly.
mesh: Object3D | GeometryBVH | null = null,
// The BVH to visualize. When the first argument is a `GeometryBVH`, this argument is interpreted as `depth`.
bvh: GeometryBVH | number | null = null,
// Maximum tree depth to display.
depth: number = 10
)update(): voidRebuilds the helper's display geometry from the current BVH state. Must
be called after changes to the BVH, depth, displayParents, or
displayEdges.
dispose(): voidDisposes of the materials and geometries used by the helper.