createTransform3D

View sourcecreateTransform3D(x?: number, y?: number, z?: number, ox?: number, oy?: number, oz?: number, sx?: number, sy?: number, sz?: number): [Position3D, Orientation3D, Scale3D, GlobalTransform3D]

Creates the standard 3D transform component bundle for an entity.

The returned tuple contains Position3D, Orientation3D, Scale3D, and GlobalTransform3D in insertion order. Position defaults to (0, 0, 0), Euler orientation defaults to (0, 0, 0), and scale defaults to (1, 1, 1). The three orientation arguments are converted to a quaternion through Quaternion.fromEuler before they are copied into Orientation3D.

Examples

import { World } from '@wimaengine/ecs'
import { createTransform3D } from '@wimaengine/transform'

const world = new World()
world.spawn(createTransform3D(0, 1, 0, 0, Math.PI / 2, 0))

Parameters

NameDescriptionDefault
x?

Initial x position.

0
y?

Initial y position.

0
z?

Initial z position.

0
ox?

Initial Euler rotation around x.

0
oy?

Initial Euler rotation around y.

0
oz?

Initial Euler rotation around z.

0
sx?

Initial x scale.

1
sy?

Initial y scale.

1
sz?

Initial z scale.

1

Returns

Ordered component bundle containing Position3D, Orientation3D, Scale3D, and GlobalTransform3D.