Skip to content

marble3 / GraphicEntity

Class: GraphicEntity ​

Defined in: src/entity/graphic.ts:11

The base of everything an FPS holds: a scene node to hang visuals on, a unique id, and the two hooks the engine calls, update() every frame and dispose() on removal. It has no physics (see PhysicEntity) and is not interactive unless it implements Interactable.

Extended by ​

Constructors ​

Constructor ​

new GraphicEntity(): GraphicEntity

Defined in: src/entity/graphic.ts:21

Returns ​

GraphicEntity

Properties ​

disposed ​

protected disposed: boolean = false

Defined in: src/entity/graphic.ts:19


id ​

id: string

Defined in: src/entity/graphic.ts:16

Unique per entity. Keys FPS.entities, and is stamped on collision shapes so a ray or contact hit resolves back to its entity.


three ​

three: Group

Defined in: src/entity/graphic.ts:18

The entity's node in the scene; FPS.add() puts it there. Add your meshes under it.

Methods ​

dispose() ​

dispose(): void

Defined in: src/entity/graphic.ts:30

Frees the geometry and instance buffers under three and takes it out of the scene. Idempotent. Materials and textures are not freed, since they are often shared: dispose your own. A subclass frees what else it owns, then calls super.dispose().

Returns ​

void


update() ​

update(_delta?, _engine?): void

Defined in: src/entity/graphic.ts:45

Called every frame the world is not paused, with the seconds since the last frame and the FPS the entity lives in (for its world and entities).

Parameters ​

_delta? ​

number = 0

_engine? ​

FPS

Returns ​

void