Scale3D

View source

ExtendsVector3

Stores an entity’s local scale in 3D space as an ECS component. Its coordinates default to (1, 1, 1) when omitted, preserving the entity’s original size on every axis.

Use it with World and Query when an entity needs a mutable 3D scale. It extends Vector3.

Examples

import { Query, World } from '@wimaengine/ecs'
import { Scale3D } from '@wimaengine/transform'

const world = new World()
world.spawn([new Scale3D(2, 1, 0.5)])

const scales = new Query(world, [Scale3D])
scales.each(([scale]) => {
  scale.set(scale.x * 0.5, scale.y * 0.5, scale.z * 0.5)
})

Constructor


constructor(x?: number, y?: number, z?: number)

View source

Creates a local 3D scale.

Parameters

NameDescriptionDefault
x?

Scale along the local x-axis.

1
y?

Scale along the local y-axis.

1
z?

Scale along the local z-axis.

1

Methods


staticserialize(value: Scale3D): Vector3Like

View source

Parameters

NameDescriptionDefault
value——
  • @inheritDoc

staticdeserialize(value: Vector3Like, out?: Scale3D): Scale3D

View source

Parameters

NameDescriptionDefault
value——
out?—...
  • @inheritDoc