Acceleration2D

View source

ExtendsVector2

Represents an entity’s linear acceleration in 2D as an ECS component. A new component starts at (0, 0). Use it with Velocity2D and Position2D.

Examples

import { Query, World } from '@wimaengine/ecs'
import { Acceleration2D } from '@wimaengine/movable'

const world = new World()
world.spawn([new Acceleration2D(0, -9.8)])

new Query(world, [Acceleration2D]).each(([acceleration]) => {
  acceleration.x += 2
})

Constructor


Methods