Const
Configuration object for the axis geometry
A mesh entity representing the coordinate axes
Creates a cube mesh entity with optional physics simulation.
Configuration object for the cube geometry and physics properties
A mesh entity representing the cube, with physics component if specified
Creates multiple cube mesh entities efficiently by sharing the same mesh geometry. This is more performance-friendly than creating individual cubes when you need many instances.
The number of cube entities to create
Configuration object for the cube geometry and physics properties
An array of mesh entities representing the cubes
// Create 100 cubes for instancing
const cubes = createCubes(100, {
widthVector: Vector3.fromCopy3(0.5, 0.5, 0.5),
physics: { use: true, move: true }
});
// Position them individually
cubes.forEach((cube, index) => {
cube.localPosition = Vector3.fromCopy3(index % 10, 0, Math.floor(index / 10));
});
Creates a grid mesh entity for visual reference.
Configuration object for the grid geometry
A mesh entity representing the grid
Creates a joint mesh entity for skeletal animation or mechanical connections.
Configuration object for the joint geometry
A mesh entity representing the joint
Creates a line mesh entity.
Configuration object for the line geometry
A mesh entity representing the line
Creates a plane mesh entity with configurable orientation.
Configuration object for the plane
A mesh entity representing the plane
Creates a mesh entity from a primitive shape. This is a utility function used internally by other creation methods.
The primitive shape to convert into a mesh entity
A mesh entity containing the primitive shape
Creates a sphere mesh entity with optional physics simulation.
Configuration object for the sphere geometry and physics properties
A mesh entity representing the sphere, with physics component if specified
Creates multiple sphere mesh entities efficiently by sharing the same mesh geometry. This is more performance-friendly than creating individual spheres when you need many instances.
The number of sphere entities to create
Configuration object for the sphere geometry and physics properties
An array of mesh entities representing the spheres
// Create 50 spheres for a particle system
const spheres = createSpheres(50, {
radius: 0.2,
physics: { use: true, move: true, density: 0.5 }
});
// Scatter them randomly
spheres.forEach(sphere => {
sphere.localPosition = Vector3.fromCopy3(
Math.random() * 10 - 5,
Math.random() * 10,
Math.random() * 10 - 5
);
});
Creates an axis mesh entity for coordinate system visualization. Typically displays X, Y, and Z axes with different colors.