createBasicMesh3D

View sourcecreateBasicMesh3D(mesh?: Handle<Mesh>, material?: Handle<BasicMaterial>, x?: number, y?: number, z?: number, ox?: number, oy?: number, oz?: number, sx?: number, sy?: number, sz?: number): [Position3D, Orientation3D, Scale3D, GlobalTransform3D, Meshed, BasicMaterialInstance]

Creates an ordered 3D mesh component tuple for World#spawn.

The tuple contains, in order, the four components returned by createTransform3D: Position3D, Orientation3D, Scale3D, and GlobalTransform3D; it then appends Meshed and BasicMaterialInstance. The supplied mesh and material handles are passed directly to those component constructors, so this helper does not clone either handle.

After the two handles, arguments are forwarded to createTransform3D in this order: x, y, z, ox, oy, oz, sx, sy, sz. Position and Euler-angle arguments default to 0; scale arguments default to 1.

Examples

import { World } from '@wimaengine/ecs'
import { createBasicMesh3D } from '@wimaengine/render-core'

const world = new World()
// `mesh` and `material` are existing asset handles.
const entity = world.spawn(createBasicMesh3D(mesh, material, 0, 0, -2))

Parameters

NameDescriptionDefault
mesh?

Mesh handle passed to Meshed.

—
material?

Basic material handle passed to BasicMaterialInstance.

—
x?

3D position x-coordinate passed to createTransform3D.

0
y?

3D position y-coordinate passed to createTransform3D.

0
z?

3D position z-coordinate passed to createTransform3D.

0
ox?

Euler rotation around the x-axis passed to createTransform3D.

0
oy?

Euler rotation around the y-axis passed to createTransform3D.

0
oz?

Euler rotation around the z-axis passed to createTransform3D.

0
sx?

3D x-axis scale passed to createTransform3D.

1
sy?

3D y-axis scale passed to createTransform3D.

1
sz?

3D z-axis scale passed to createTransform3D.

1

Returns

Ordered 3D transform, mesh, and material components.