Atlas Engine
API Referenceatlas

GameObject

Base class for scene objects with a transform, visibility, and attached components.

Module: atlas

Base class for scene objects with a transform, visibility, and attached components.

Declaration

export abstract class GameObject { ... }

Constructors

constructor();

Properties

id

id: number;

components

components: Component[];

position

position: Position3d;

rotation

rotation: Rotation3d;

scale

scale: Scale3d;

name

name: string;

Methods

attachTexture

Attaches a texture to this object.

attachTexture(texture: Texture): void;

setPosition

Sets the position to an absolute value.

setPosition(position: Position3d): void;

move

Translates by the supplied offset.

move(position: Position3d): void;

lookAt

Orients toward the target position.

lookAt(target: Position3d, up?: Normal3d): void;

setRotation

Replaces the rotation.

setRotation(rotation: Rotation3d): void;

rotate

Applies an incremental rotation.

rotate(rotation: Rotation3d): void;

setScale

Replaces the scale factors.

setScale(scale: Scale3d): void;

scaleBy

Multiplies the current scale component-wise by the supplied factors.

scaleBy(scale: Scale3d): void;

show

Makes the object visible.

show(): void;

hide

Makes the object invisible.

hide(): void;

as

as<T extends GameObject>(type: new (...args: any[]) => T): T | null;

addComponent

Attaches a component to this object.

addComponent<T extends Component>(component: T): void;

On this page