Class
Position2D
View sourceExtendsVector2
Stores an entity’s local position in 2D space as an ECS component. Its
coordinates default to (0, 0) when omitted.
Use Position2D with World and Query when an
entity needs a mutable 2D position. It extends Vector2.
Examples
import { Query, World } from '@wimaengine/ecs'
import { Position2D } from '@wimaengine/transform'
const world = new World()
world.spawn([new Position2D(10, 20)])
function moveRight(world) {
const positions = new Query(world, [Position2D])
positions.each(([position]) => {
position.x += 1
})
}
moveRight(world)