Orientation3D

View source

ExtendsQuaternion

Stores an entity’s local 3D orientation as an ECS component.

Orientation3D extends Quaternion to represent local rotation in 3D space. New instances use the identity orientation, leaving the entity’s local rotation unchanged until the component is updated.

Examples

import { Query, World } from '@wimaengine/ecs'
import { Quaternion } from '@wimaengine/math'
import { Orientation3D } from '@wimaengine/transform'

const world = new World()
world.spawn([new Orientation3D()])

const orientations = new Query(world, [Orientation3D])
const turn = Quaternion.fromEuler(0, Math.PI / 2, 0)
orientations.each(([orientation]) => {
  orientation.copy(orientation.multiply(turn).normalize())
})

Constructor


Methods