Skip to content

Latest commit

 

History

History
219 lines (99 loc) · 2.86 KB

File metadata and controls

219 lines (99 loc) · 2.86 KB

Home > server > ModelRegistry

ModelRegistry class

Manages model data for all known models of the game.

Signature:

export default class ModelRegistry 

Remarks

The ModelRegistry is created internally as a global singletone accessible with the static property ModelRegistry.instance.

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ModelRegistry class.

Example

import { ModelRegistry } from 'hytopia';

const modelRegistry = ModelRegistry.instance;
const boundingBox = modelRegistry.getBoundingBox('models/player.gltf');

Properties

Property

Modifiers

Type

Description

instance

static

readonly

ModelRegistry

The global ModelRegistry instance as a singleton.

optimize

boolean

Whether to use optimized models when they are loaded.

optimizeEveryStart

boolean

Whether to always run model optimization on server start.

Methods

Method

Modifiers

Description

getAnimationNames(modelUri)

Retrieves an array of all known animation names for a model.

getBoundingBox(modelUri)

Retrieves the bounding box of a model.

getHeight(modelUri)

Retrieves the Y-axis height of a model for a scale of 1.

getNodeNames(modelUri)

Retrieves the names of all nodes in a model.

getTrimesh(modelUri, scale)

Retrieves the trimesh of a model.

modelHasNode(modelUri, nodeName)

Checks if a model has a node with the given name.