Clones
Clone
This creates a deep copy of the original mesh and saves memory by sharing the geometry. Each clone can have its own material and transformation. Operations that manipulate the vertex data will be applied to all shared geometries. If you need to make independent changes to a clone's geometry, you must call a method like clone.makeGeometryUnique(), which will disconnect the shared geometry and allow you to treat the clone as its own mesh/geometry.
import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";const box1 = MeshBuilder.CreateBox("box1", { height: 1, width: 0.75, depth: 0.25, updatable: true });const box2 = box1.clone("box2");box1.position.x = -1;box2.position.x = 1;Note that as of v5.0, cloning a mesh with a skeleton will assign that skeleton to the clone, i.e., the skeleton is shared. If your clone does not need a skeleton, simply set it to null.
clone.skeleton = null;Alternatively, if your clone needs a skeleton, simply clone the source mesh's skeleton.
clone.skeleton = mesh.skeleton.clone();Examples
Cloning Example 1 Shows shared geometry by scaling one geometry by 2.
Cloning Example 2 Shows transformation by scaling of 2 only changes one mesh.