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>renderOrder— Draw order for custom-shader meshes. See Shaders. Ordinary meshes use the engine's shared opaque or transparent batch order.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)wind— Optional wind displacement strength,nullby default;0is still and1is maximum sway. Applies to ordinary batched meshes, including transparent meshes, not skinned meshes or custom shaders. Callsync()after changing it.boundingBoxWorld— World-space box for a processed non-skinned mesh; initiallynull
Wind
mesh.wind = 0.6
mesh.sync()
// Disable again with mesh.wind = 0, then mesh.sync().
Alternatively, set mesh.userData.wind = 0.6 and call mesh.sync().
mesh.wind takes precedence when non-null, including an explicit 0 to disable
wind. When mesh.wind is null or undefined, userData.wind is used instead;
if neither is set, wind is disabled.
Wind uses smooth spatial gusts and elapsed time, with cubic bending from the local bounding-box bottom toward the top. No special UV layout is required. Use geometry with vertical subdivisions for a curved silhouette. Strength is clamped to 0–1 on upload; non-finite or non-number values disable displacement. For a model or group, assign the property to its individual mesh children.
Each mesh retains its own strength even when sharing geometry or material. Copies and saved objects preserve the property. Shadows, planar reflections, and outlines follow the displaced surface; culling bounds expand automatically. CPU raycasts, collision, and voxel AO still use the original geometry. Wind meshes should not be used as static occluders. Active wind also refreshes the far shadow cascade each frame, adding shadow rendering cost.
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