UNPKG

hytopia

Version:

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

66 lines (32 loc) 1.42 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; [setModelScale](./server.entity.setmodelscale.md) ## Entity.setModelScale() method Sets the scale of the entity's model and proportionally scales its colliders. **Signature:** ```typescript setModelScale(modelScale: Vector3Like | number): void; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> modelScale </td><td> [Vector3Like](./server.vector3like.md) \| number </td><td> The scale of the entity's model. Can be a vector or a number for uniform scaling. \*\*Side effects:\*\* Scales existing colliders and emits `EntityEvent.SET_MODEL_SCALE` when spawned. \*\*Category:\*\* Entities </td></tr> </tbody></table> **Returns:** void ## Remarks Model entities only; no effect for block entities. \*\*Collider scaling is relative:\*\* Colliders are scaled by the ratio of new/old scale, not set to absolute values. Example: scaling from 1 to 2 doubles collider size; scaling from 2 to 4 also doubles it. \*\*Reference equality check:\*\* Uses `===` to compare with current scale, so passing the same object reference will early return even if values changed. Always pass a new object.