Troubled with resizing accessories and applying scaling to excess parts

I have recently converted a morph system over to accessories from models welded to characters. I find that working with accessories is much easier a treat to work with and it looks fairly clean. The only problem I’ve run into is resizing accessories and I haven’t a clue what I should do.

Changing scaling on humanoids resizes both the accessory’s root and the rest of the character just fine. The rest of the parts, however, do not resize with the accessory. I’m thus left with the following abomination of a character:

image

As you can see, the character itself scales up as it should. The only that isn’t scaling up are the non-transparent parts, which form the rig. A further look shows that only the root of the accessory scales up, but everything else does not.

image

So, with that being said, I haven’t a single clue of how to apply scaling to the rest of the accessory’s parts. Anyone work with multi-part accessories able to give me a nudge in the right direction?

Further details and comments, if they are of any use:

  • All parts are welded to the root via WeldConstraints.
  • I have confirmed that the morph is rigged properly for each limb.
  • I haven’t yet tried a resize function yet because I’d like to use that as a last resort; for now, I want to rely on how the backend handles accessories to resolve this.
  • I did try switching weld types. I don’t know why I thought this would be of any effect, it wasn’t.
  • I cannot provide repros of this specific model if they’re needed to diagnose problems.

Screenshot of rig and example hierarchy:

2 Likes

I’m encountering this very issue with an Accessory object I’m using for shoes. The “Handle” appears to change size however the rest of the pieces (connected via WeldConstraints) do not. This is a big problem for me, I may end up having to create a Resize function, which could get messy… following this thread.

1 Like

I encountered this previous issue from a previous commission. Too bad I had to apply some auto-scale function for accessories, yikes. Maybe we could add a feature request for auto-scaling of accessory in proportion to the scaling on humanoids?

:thinking:

4 Likes

If you could, would you mind sharing that supposed auto sizing function you created? I’m personally thinking of resizing parts relative to the root, but I haven’t a clue how well that’ll work out.

Knowing the sizing implementation on the backend could help with this, but the original issue of going without a function exists.

If there truly is no solution other than implementing a resize function, I will be disappointed and hit the feature requests category.

Apparently I am forced to write the function from scratch again(left the code at home and I have to wait a week to return from vacation).

Scaling
If I recall correctly, the X-axis is always the width of the accessory, Y-axis is naturally the height and Z-axis is obviously the depth. The configuration goes along with scaling the mesh of the accessory and multiplying the X, Y and Z to according:

local widthMultiplier = Humanoid.BodyWidthScale.Value -- X
local heightMultiplier = Humanoid.BodyHeightScale.Value -- Y
local depthMultiplier = Humanoid.BodyDepthScale.Value -- Z

Multiply the scale to respective values. I think this goes under the listener of values changing on the scaling. Sometimes this fails due to horrible orientation of each part of them. Might use a workaround of an extra part acting as the PrimaryPart which has the orientation facing forward.


Positioning
This step only applies for accessories with heavy offset from its attachment.

Oh dear, this is horribly confusing when I was working with it. All parts do have different orientation due to how they were modelled. The best method I could think of is to get the relative position from the center and scale the offset to according as above. I think it was CFrame?

Remember to use the PrimaryPart to position.


Happy experimenting, because I reckon that the script I made was awfully old(over 6 months old, that’s when I actually started to get the hang of scripting) and probably could be written in a more “effective” way.

1 Like

Everything with the rig itself is fine. The root is the PrimaryPart you proposed. The only issue is trying to resize (and potentially reposition) excess parts relative to the resized accessory root. As for head accessories, there’s also HeadScale to account for.

I figured an end result had something to do with multiplication based on these factors. Knowing how the backend resizes accessories would be completely helpful for this.

1 Like

The only worry I find is the parts which are tilted. Then you have to apply some extra multiplication basing on the extra part’s orientation. Yikes.

:frowning_face:

I might write one function that goes for all-case scenario on my vacation, I guess.

Non-problem. Parts can be offset relative to the root of the accessory they’re under, which by token that root is welded to the limb. Tilted limbs won’t affect any multiplication factors. The concern lies solely with part sizing.

1 Like

Went on another search spree, turned up some threads that seem to cover the same problem. I’ll be experimenting with these solutions alongside what’s been posted above and my own thoughts. Turns out “resize accessory” didn’t contain what I needed.

The last thread is especially important because it directly reflects my use case.

1 Like

Little late, but an update. I have attempted the above solutions and none of them work in the way I expected. The morph I attempted this on is different from the one in the OP only by construct, but follows the same paradigm.


The space in the gratings should be filled red, instead of poking out at the top.

I could be close. The sizes look right but the positions are odd.

I have the feeling like I ought to just get rep for support towards the last posted thread in the above response. I haven’t a clue as to what I’m doing or if I’m applying the code samples in each of those threads correctly (I used them raw as-is).

I generally don’t want to touch resize functions without knowing what I’m doing because of how messy and cumbersome run time resizing can get.

Has anyone yet found a for sure solution to this? @PostApproval I know what you mean when you say you don’t like to touch resizing functions without knowing exactly what you’re doing. I’m in the same boat. I wish the accessories would automatically do this for you. It definitely should be a roblox feature.

At the moment, no I have not yet found a solution, which is why I’ve left the top thread (my thread on the matter) unmarked. I’ve tried experimenting with a bunch of different methods, currently leaving that progress on hiatus though so I can focus on other things.

Hey there!

I recently encountered this issue and was able to solve it through the following function that I wrote. I hope you find it useful!

function adjust(s, h, w)
    for i,v in pairs(s:GetChildren()) do
        if v.Name ~= "Handle" and v:IsA("BasePart") then
            v.Size = Vector3.new(v.Size.X * w, v.Size.Y * h, v.Size.Z * w)
            local d = v.Position - s.Handle.Position
            v.Position = v.Position + Vector3.new(d.X * (w - 1), d.Y * (h - 1), d.Z * (w - 1))
        end 
    end
end
adjust(source, height, weight)

Good luck!

Edit: You can incorporate depth/width into this, for my purposes I only used a general “weight”. (in case you didn’t know s is the accessory, h is height and w is weight ;p)

Edit 2: Just realized this doesn’t work great when called multiple times. Trying to come up with a mathy way of solving this.

What is “weight”? Accessories have no concept of weight. Also, from reading your calculations, you use this W value across two axis but I don’t think this would help very much considering the fact that height, width and depth are all applied differently in regards to accessory scaling.

Could you show this code at work? I’m not so certain this resolves my problem.

Sorry about the confusion. In my game I don’t keep track of depth/width, I use a single float for that part. The “weight” in the function in my understanding is how “fat” the character is, i.e. their dimensions across the X/Z axis.

Here’s a gif of it working:

The shoe looks like one piece, but it has two parts, a semi transparent mesh part, and the same mesh part slightly smaller but neon.

https://gyazo.com/bc7a0fa5d3f51e9751ebf26bfc197ab6

Also, here’s the fixed code. You just have to track and know the previous weight/height before calling adjust() again.

function adjust(s, h, w, ph, pw)
    for i,v in pairs(s:GetChildren()) do
        if v.Name ~= "Handle" and v:IsA("BasePart") then
            local originalSize = Vector3.new(v.Size.X / pw, v.Size.Y / ph, v.Size.Z / pw)
            v.Size = Vector3.new(originalSize.X * w, originalSize.Y * h, originalSize.Z * w)
		
            local d = v.Position - s.Handle.Position
            v.Position = v.Position + Vector3.new(d.X * (w - 1), d.Y * (h - 1), d.Z * (w - 1))
        end 
    end
end 

adjust(source, 5, 3, 1, 1)
wait(2)
adjust(source, 10, 10, 5, 3)
1 Like

Thanks for the showcase. It looks pretty close enough to what I’m looking for (save for the vague variable names, which I don’t find to be very helpful in deriving any information other than understanding that some value goes somewhere).

Do you know how I can get this resize function to work specifically with the scaling values in humanoids? That’s chiefly what I want, for accessories to be resized along with the scaling values. Although this function technically answers the question as far as getting accessories to resize, what I’m more specifically looking to tackle is resizing them according to the scaling values.

Related question:

Here, check out this different rendition. I expanded the variables a little more!

function adjust(s, height, width, depth, prevHeight, prevWidth, prevDepth)
    for i,v in pairs(s:GetChildren()) do
        if v.Name ~= "Handle" and v:IsA("BasePart") then
            local originalSize = Vector3.new(v.Size.X / prevWidth, v.Size.Y / prevHeight, v.Size.Z / prevDepth)
            v.Size = Vector3.new(originalSize.X * width, originalSize.Y * height, originalSize.Z * depth)
		
            local d = v.Position - s.Handle.Position
            v.Position = v.Position + Vector3.new(d.X * (width - 1), d.Y * (height - 1), d.Z * (depth - 1))
        end 
    end
end 

adjust(source, 5, 3, 1, 1)
wait(2)
adjust(source, 10, 10, 5, 3)

Edit: In this scenario I track the previous height/depth/width for finding original sizes/positions. You can instead have two Vector3 values in each part to keep track of their original size/positions, but it is up to you.

I’m not really sure on how their scalings work but I imagine it’s something to do in their Animate script, or one of the character related scripts.

1 Like

Animate is strictly for animating, it doesn’t have to do with resizing character assets. The only other script as well is Health (Sounds would be one as well, but has long since been replaced).

Accessory resizing is probably baked into the Humanoid object right now so I’m trying to figure out how to scale with those values specifically. If I need to feed arbitrary values into a function without any idea as to where I’m supposed to go, then there’s no real merit in using a solution because likewise I won’t know how to maintain it. I don’t use things I don’t understand.

Thanks for the help anyway, appreciate it.

Did you guys find a solution to this? I’m having the same problem.