Examples
import { World } from '@wimaengine/ecs'
import { createMovable2D } from '@wimaengine/movable'
const world = new World()
world.spawn(createMovable2D(10, 20, Math.PI / 4))Function
createMovable2D(x?: number, y?: number, a?: number): [Position2D, Orientation2D, Scale2D, GlobalTransform2D, Velocity2D, Rotation2D, Acceleration2D, Torque2D]Creates an ordered 2D transform and motion component bundle.
The returned tuple is ready for World#spawn and contains, in
insertion order, Position2D, Orientation2D,
Scale2D, GlobalTransform2D, Velocity2D,
Rotation2D, Acceleration2D, and Torque2D.
Position defaults to (0, 0), the angle defaults to 0 radians, scale
defaults to (1, 1), and all motion components default to zero.
import { World } from '@wimaengine/ecs'
import { createMovable2D } from '@wimaengine/movable'
const world = new World()
world.spawn(createMovable2D(10, 20, Math.PI / 4))