In Studio, it is currently possible to scale objects via the Scale tool, however doing so in-game or in community plugins is not as convenient. That changes today! We are excited to introduce a Scale Factor for Models beta feature which adds the following scaling APIs on Model:
Model:GetScale()Returns the current scale factor of the Model, which starts at 1 for existing and newly created Models. This scale factor is a property of the model which persists.
Model:ScaleTo(scaleFactor)Sets the scale factor of the Model and updates the values of all scalable properties of descendants of the Model accordingly. All properties which have some geometric interpretation in the scene are scalable, including sizes, forces, speeds, etc. The scaling happens around the pivot.
The beta feature then integrates these APIs into Studio and the engine in three key ways:
- Scaling in Studio “just works” on all types of content.
- The package system supports scaling of packages
- The animation system supports scaled playback of animations
Enabling the "Scale Factor for Models" beta
In the File menu select Beta Features and toggle on Scale Factor for Models in the Beta Features dialog. You will have to restart Studio for the change to apply.
What does this mean? The Scale tool in Studio will now call
ScaleTo when scaling models. Since
ScaleTo scales many things and not just part sizes, you can now expect the Scale tool to scale a much wider array of Instance types under the models you scale rather than just changing the sizes of parts. This includes scaling:
- Visual effects like ParticleEmitters and Beams
- The rolloff distance of Sounds
- Forces and Torques in constraints
- Humanoid settings under character rigs
The properties pane now includes a numeric “Scale” property on Models, meaning you can have it scaled to exactly how you want it!
Last but not least, dynamic object placement in-game or in plugins became a lot more simple with this update. The majority of dynamic object placement code can now be as simple as:
This is super convenient for us developers who don’t want to go through pain to achieve a simple change, really needed!
local object = prototype:Clone()
object.Parent = ...
Ever created several copies of the same animation to support different rig sizes, especially with R6? That’s something you’ll never have to do again.
The Animator Instance will key into the scale API to support scaled playback of animations!
Specifically, the Animator instance will scale any joint offsets in an animation by the scale factor of the Model the rig is rooted under. That means you’ll be able to dynamically scale a rig by calling
:ScaleToin-game and have your animations work properly on that scaled rig.
To be honest, I’m really glad that Roblox has introduced this. With this scaling now simplified it’s going to remove a lot of confusion for first time developers.
It’s also going to help with us more matured developer who no longer need to perform complex operations to achieve simple goals.
What are your opinions on this? Area you already going to enable this in the beta features or are you going to wait until it’s fully done?
Let us know down below!