constructor(x?: number, y?: number, z?: number, w?: number)
View sourceCreates a quaternion from components.
Class
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.
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(x?: number, y?: number, z?: number, w?: number)Creates a quaternion from components.
copy(source: Orientation3D, target?: Orientation3D): Orientation3Ddefault(): Orientation3Dclone(target: Orientation3D): Orientation3Dserialize(value: Orientation3D): QuaternionLikedeserialize(value: QuaternionLike, out?: Orientation3D): Orientation3D