Class
GlobalTransform3D
View sourceExtendsAffine3
Stores an entity’s resolved 3D world-space transform as an ECS component.
Use GlobalTransform3D with Position3D,
Orientation3D, and Scale3D when an entity needs a
computed world-space pose. A root entity’s value reflects its local
transform; a child entity’s value also includes the transforms above it in
the Parent/Children hierarchy. The component extends
Affine3 for affine 3D transform data and operations.
Examples
import { Query, World } from '@wimaengine/ecs'
import { Vector3 } from '@wimaengine/math'
import {
GlobalTransform3D,
Orientation3D,
Position3D,
Scale3D
} from '@wimaengine/transform'
const world = new World()
world.spawn([
new Position3D(),
new Orientation3D(),
new Scale3D(),
new GlobalTransform3D()
])
const transforms = new Query(world, [GlobalTransform3D])
transforms.each(([global]) => {
const worldOrigin = global.transform(new Vector3())
console.log(worldOrigin.x, worldOrigin.y, worldOrigin.z)
})