createCamera3D

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

Creates the ordered component tuple for a 3D camera entity.

The returned tuple contains Position3D, Orientation3D, Scale3D, GlobalTransform3D, Camera, and RenderLists3D, in that order. The transform components are created by createTransform3D; x, y, and z set position, ox, oy, and oz set Euler orientation, and sx, sy, and sz set scale. The camera is created with new Camera(), so it uses its default PerspectiveProjection; the final component is a new RenderLists3D.

Pass the returned tuple directly to World#spawn to create the camera entity.

Examples

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

const world = new World()
const cameraEntity = world.spawn(createCamera3D(0, 0, 5))

Parameters

NameDescriptionDefault
x?

X position passed to createTransform3D.

0
y?

Y position passed to createTransform3D.

0
z?

Z position passed to createTransform3D.

0
ox?

X Euler orientation passed to createTransform3D.

0
oy?

Y Euler orientation passed to createTransform3D.

0
oz?

Z Euler orientation passed to createTransform3D.

0
sx?

X scale passed to createTransform3D.

1
sy?

Y scale passed to createTransform3D.

1
sz?

Z scale passed to createTransform3D.

1

Returns

Ordered 3D camera components for World#spawn.