Mesh
A triangular polygon mesh. Combines a BufferGeometry with a Material.
Extends Object3D.
Constructor
const mesh = new Mesh(geometry?, material?)
// defaults: new BufferGeometry(), new Material()
Properties
isMesh— Type flag (true)geometry— BufferGeometrymaterial— Material or Array<Material>collider— Whether built-in player collision uses the mesh (defaulttrue)raycastBoundsOnly— When strictlytrue, raycast the world-space bounding box instead of triangle geometry (defaultundefined)stream— Whether geometry streaming is enabled (defaultfalse)boundingBoxWorld— World-space box for a processed non-skinned mesh; initiallynull
Bounds
geometry.boundingBox is local to the mesh. Imported model meshes normally
include it; other geometry may remain null until computeBoundingBox() or
renderer/raycast processing. Recompute it after changing vertex positions.
For non-skinned meshes, Unia creates boundingBoxWorld during scene processing
and updates it after synchronized transform changes. Bounds are per mesh;
groups and model roots have no aggregate bound. Skinned meshes do not use this
bounds path, and the standard raycaster currently skips them.
Call sync() after transform changes. updateMatrixWorld() alone does not
refresh renderer bounds. Box3.setFromObject() can aggregate current per-mesh
world bounds across a hierarchy.
Raycasting
Raycastable ordinary meshes and custom-shader meshes use their CPU triangle
geometry by default. Set mesh.raycastBoundsOnly = true before registering the
mesh to use its world-space axis-aligned bounding box instead. Only strict
true enables bounds-only raycasting; undefined, null, and false retain
full-geometry raycasting.
Bounds-only raycasts return distance 0 when the ray starts inside the box.
For a vertex shader that displaces geometry, update or expand the local
geometry.boundingBox so the bounds contain the maximum rendered deformation.
Methods
copy(source, recursive?)— Copy mesh data