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

Creates a new game object.

constructor();

Properties

id

The runtime identifier for this object.

id: number;

components

The components attached to this object.

components: Component[];

position

The position in world space.

position: Position3d;

rotation

The Euler rotation in degrees.

rotation: Rotation3d;

scale

The scale along each axis.

scale: Scale3d;

name

The human-readable 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.

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