Skip to content

marble3 / Crosshair

Class: Crosshair ​

Defined in: src/cursor/crosshair.ts:26

A shooter's reticle in the middle of the screen, red while the camera looks at any body. It draws nothing in the scene; add it to the FPS so that it is updated every frame.

Extends ​

Constructors ​

Constructor ​

new Crosshair(camera): Crosshair

Defined in: src/cursor/crosshair.ts:31

Parameters ​

camera ​

Camera

Returns ​

Crosshair

Overrides ​

GraphicEntity.constructor

Properties ​

disposed ​

protected disposed: boolean = false

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

Inherited from ​

GraphicEntity.disposed


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.

Inherited from ​

GraphicEntity.id


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.

Inherited from ​

GraphicEntity.three

Methods ​

dispose() ​

dispose(): void

Defined in: src/cursor/crosshair.ts:62

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

Overrides ​

GraphicEntity.dispose


update() ​

update(_delta, engine?): void

Defined in: src/cursor/crosshair.ts:52

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

engine? ​

FPS

Returns ​

void

Overrides ​

GraphicEntity.update