JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q56359F
  • License ISC

Scale and Resize Models and Parts while maintaining correct relationships with descendants

Package Exports

  • @rbxts/scale-model

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rbxts/scale-model) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@rbxts/scale-model

Uniformly scale/resize Models and Parts and all Descendants

Currently scaling the following types and properties:

  • Model (Size, Position)
  • BasePart (Size, Position)
  • Attachment (Position) (and thus connected Constraints, e.g. Welds and Joints)
  • SpecialMesh (Scale)
  • Fire (Size)
  • Explosion (BlastPressure, BlastRadius)
  • ParticleEmitter (Size: NumberSequence)

Usage

  1. Install npm package
npm i @rbxts/scale-model
  1. Import scaleModel or scalePart
import { scaleModel, scalePart } from '@rbxts/scale-model';
  1. Pass a Model or Part, with a scale factor. Scale factor > 1 is bigger, < 1 is smaller
scaleModel(myModel, 1.5);   // All descendants of myModel to 150% size

scalePart(myPart, 0.5);     // myPart and all descendants to 50% size

Custom Scaling Center

You can optionally provide a custom center point in the 3rd parameter, instead of using the Model's PrimaryPart's Position, or the Part's Position. The scaling of a Model can fail if attempted on a Model that doesn't have a PrimaryPart defined, and no custom center is provided. In that case, a message will be printed in the output.

Did I miss your favorite Descendant?

Pull Requests are welcome if there's something I missed. Or, open an Issue.

Roblox-TS

Part of the ever-growing Roblox-TS community.

Roblox

Friend me on Roblox, my Avatar is FirstVertex.

✌️