UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

62 lines (30 loc) 1.21 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [Entity](./server.entity.md) &gt; [getModelAnimation](./server.entity.getmodelanimation.md) ## Entity.getModelAnimation() method Gets or lazily creates a model animation for the entity's model by name. **Signature:** ```typescript getModelAnimation(name: string): EntityModelAnimation | undefined; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> name </td><td> string </td><td> The name of the animation to get or create. </td></tr> </tbody></table> **Returns:** [EntityModelAnimation](./server.entitymodelanimation.md) \| undefined The model animation instance, or `undefined` for block entities. \*\*Category:\*\* Entities ## Remarks Model entities only; returns `undefined` for block entities. If the animation does not yet exist, a new instance with default settings is created and added to `modelAnimations`<!-- -->. Use `availableModelAnimationNames` to discover which animation names exist in the model.