Examples
const entity = world.spawn([
...createBasicMesh2D(mesh, material, 0.25, 0.1)
])Function
createBasicMesh2D(mesh?: Handle<Mesh>, material?: Handle<BasicMaterial>, x?: number, y?: number, a?: number, sx?: number, sy?: number): [Position2D, Orientation2D, Scale2D, GlobalTransform2D, Meshed, BasicMaterialInstance]Creates an ordered 2D mesh component tuple for World#spawn.
The tuple contains, in order, the four components returned by
createTransform2D: Position2D, Orientation2D,
Scale2D, and GlobalTransform2D; it then appends
Meshed and BasicMaterialInstance. The supplied mesh and
material handles are passed directly to those components, so this helper
does not create or clone either handle.
Pass the returned tuple as the component array to World#spawn, or
spread it into a larger component array when adding more components.
const entity = world.spawn([
...createBasicMesh2D(mesh, material, 0.25, 0.1)
])