Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* BasePart (Size, Position)
* Attachment (Position) (and thus connected Constraints, e.g. Welds and Joints)
* SpecialMesh (Scale)
* Humanoid
* Fire (Size)
* Texture (U/V)
* ParticleEmitter (Size: _NumberSequence_)
Expand All @@ -18,7 +19,8 @@
* Vector3 (Scale, Scale about Point)
* Tool (All Descendants, using Handle as reference)
* Joint (Thanks to [@RRainmaker](https://github.com/RRainmaker))
* Instances (generic catch-all for e.g. a Folder)
* Descendants (all descendants of an instance e.g. a Folder)
* Instance (generic catch-all for any Instance)

## Usage

Expand All @@ -27,9 +29,9 @@
npm i @rbxts/scale-model
```

2. Import `scaleModel`, `scalePart`, `scaleExplosion`, `scaleTool`, or `scaleInstances`
2. Import `scaleModel`, `scalePart`, `scaleExplosion`, `scaleTool`, or `scaleDescendants`
```typescript
import { scaleModel, scalePart, scaleExplosion, scaleTool, scaleInstances } from '@rbxts/scale-model';
import { scaleModel, scalePart, scaleExplosion, scaleTool, scaleDescendants } from '@rbxts/scale-model';
```
3. Pass a Model, Part, Explosion, Tool, or array of Instances with a scale factor. Scale factor > 1 is bigger, < 1 is smaller
```typescript
Expand All @@ -41,15 +43,13 @@ scaleExplosion(myExplosion, 10); // myExplosion to 1000% size

scaleTool(myTool, 0.8); // myTool to 80% size

scaleInstances(myFolder, 0.5, new Vector3(0,0,0)); // all instances in myFolder to 50% size
scaleDescendants(myFolder, 0.5, new Vector3(0,0,0)); // all instances in myFolder to 50% size
```

We need this special api for `scaleExplosion` since we need to scale it before it is parented.

## 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.
You can optionally provide a custom center point in the 3rd parameter, instead of using the Model's PivotPoint, or the Part's PivotPoint.

__The scaling of a Tool can fail__ if attempted on a Tool that doesn't have a Handle defined, and no custom center is provided. In that case, a message will be printed in the output.

Expand Down
Loading