hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
248 lines (111 loc) • 3.27 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [ModelRegistry](./server.modelregistry.md)
## ModelRegistry class
Manages model data for all known models of the game.
**Signature:**
```typescript
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
```typescript
import { ModelRegistry } from 'hytopia';
const modelRegistry = ModelRegistry.instance;
const boundingBox = modelRegistry.getBoundingBox('models/player.gltf');
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[instance](./server.modelregistry.instance.md)
</td><td>
`static`
`readonly`
</td><td>
[ModelRegistry](./server.modelregistry.md)
</td><td>
The global ModelRegistry instance as a singleton.
</td></tr>
<tr><td>
[optimize](./server.modelregistry.optimize.md)
</td><td>
</td><td>
boolean
</td><td>
Whether to use optimized models when they are loaded.
</td></tr>
<tr><td>
[optimizeEveryStart](./server.modelregistry.optimizeeverystart.md)
</td><td>
</td><td>
boolean
</td><td>
Whether to always run model optimization on server start.
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getAnimationNames(modelUri)](./server.modelregistry.getanimationnames.md)
</td><td>
</td><td>
Retrieves an array of all known animation names for a model.
</td></tr>
<tr><td>
[getBoundingBox(modelUri)](./server.modelregistry.getboundingbox.md)
</td><td>
</td><td>
Retrieves the bounding box of a model.
</td></tr>
<tr><td>
[getDepth(modelUri)](./server.modelregistry.getdepth.md)
</td><td>
</td><td>
Retrieves the Z-axis depth of a model for a scale of 1.
</td></tr>
<tr><td>
[getHeight(modelUri)](./server.modelregistry.getheight.md)
</td><td>
</td><td>
Retrieves the Y-axis height of a model for a scale of 1.
</td></tr>
<tr><td>
[getNodeNames(modelUri)](./server.modelregistry.getnodenames.md)
</td><td>
</td><td>
Retrieves the names of all nodes in a model.
</td></tr>
<tr><td>
[getTrimesh(modelUri, scale)](./server.modelregistry.gettrimesh.md)
</td><td>
</td><td>
Retrieves the trimesh of a model.
</td></tr>
<tr><td>
[getWidth(modelUri)](./server.modelregistry.getwidth.md)
</td><td>
</td><td>
Retrieves the X-axis width of a model for a scale of 1.
</td></tr>
<tr><td>
[modelHasNode(modelUri, nodeName)](./server.modelregistry.modelhasnode.md)
</td><td>
</td><td>
Checks if a model has a node with the given name.
</td></tr>
</tbody></table>