Skip to content

map-graph-3d.entity overview


Table of contents


utils

Gg3dMapGraphEntityOptions (type alias)

Signature

export type Gg3dMapGraphEntityOptions = {
  // depth in tree to load. 0 means load only the nearest node, 1 means nearest + all of it's neighbours etc.
  loadDepth: number
  // additional depth, means unload delay. Nodes with this depth won't load, but if already loaded, will not be destroyed
  inertia: number
  // max amount of nodes that can be loaded on single tick. Use this to avoid framerate drop when loading multiple heavy nodes at once
  maxNodesLoadingPerTick: number
}

MapGraph (class)

Signature

export declare class MapGraph

fromMapArray (static method)

Creates a new MapGraph instance from an array of elements, where each element in the array is a node in the graph. The first element of the array is used as the root node of the graph.

Signature

static fromMapArray(array: MapGraphNodeType[], closed: boolean = false): MapGraph

fromMapSquareGrid (static method)

Creates a new MapGraph instance from a two-dimensional square grid of elements, where each element in the grid is a node in the graph. The top-left element of the grid is used as the root node of the graph. The nodes in the graph are created in the same order as the elements in the grid, from left to right and then from top to bottom.

Signature

static fromMapSquareGrid(grid: MapGraphNodeType[][]): MapGraph

getNearestDummy (method)

Signature

public getNearestDummy(thisNodes: Graph<MapGraphNodeType>[], cursor: Point3): Graph<MapGraphNodeType>

nodes (method)

Signature

nodes(): MapGraph[]

MapGraph3dEntity (class)

Signature

export declare class MapGraph3dEntity<VTypeDoc, PTypeDoc> {
  constructor(public readonly mapGraph: MapGraph, options: Partial<Gg3dMapGraphEntityOptions> = {})
}

onSpawned (method)

Signature

onSpawned(world: Gg3dWorld<VTypeDoc, PTypeDoc>)

onRemoved (method)

Signature

onRemoved()

loadChunk (method)

Signature

protected async loadChunk(
    node: MapGraphNodeType,
  ): Promise<[Entity3d<VTypeDoc, PTypeDoc>[], LoadResultWithProps<VTypeDoc, PTypeDoc>]>

disposeChunk (method)

Signature

protected disposeChunk(node: MapGraphNodeType)

tickOrder (property)

Signature

readonly tickOrder: TickOrder.POST_RENDERING

loaderCursor$ (property)

Signature

readonly loaderCursor$: any

loaded (property)

Signature

readonly loaded: any

_chunkLoaded$ (property)

Signature

_chunkLoaded$: any

mapGraphNodes (property)

Signature

readonly mapGraphNodes: MapGraph[]

options (property)

Signature

readonly options: Gg3dMapGraphEntityOptions

loadClock (property)

Signature

loadClock: PausableClock | null

MapGraphNodeType (type alias)

Signature

export type MapGraphNodeType = {
  path: string
  position: Point3
  rotation?: Point4
  loadOptions: Partial<Omit<LoadOptions, 'position' | 'rotation'>>
}