Mesh Scales and MeshPart Sizes

Hello, I am trying to replace all MeshParts with Meshes in my game. I successfully replaced them all accordingly based on their Position and Orientation.

MeshPart sizes are determined by the Size property because it is a BasePart.

Mesh sizes are determined by the Scale property.

The issue is that I do not know how to determine the correct Scale to equal the Size. Any help is appreciated.

3 Likes

perhaps you might try doing a search for mesh scaling.
I did and got lots of information.

Perhaps you could show me your research?

1 Like

I believe that scale is a value that is used to define the size on the axis as a factor of the size of the base part so 1 is 100%. If you want the mesh to cover all the face then use 1 if only half then 0.5 etc.

I understand that.

The issue is that I do not know how to convert Size to Scale. I am attempting to replace all MeshParts to Meshes, and that requires the Mesh to have the same size.

I have tried determining the XYZ of the Scale by dividing the respective numbers by the biggest number found in the Vector3 of the MeshPart’s Size that it was replacing. That did not work. They were proportionally the same, but were huge in size.

local Scale = BasePartParentSize --I think…

Hello,

The size of a Mesh is usually the scale it spawns at, so if its original size is 10.967, 3.997, 11.537, you might have to do some extensive testing to get the results you want.

If you can’t figure out a simpler way, I would suggest using a Vector3 Value to have an “OriginalSize” value (which, for example, can be 10.967, 3.997, 11.537). You could then do some simple division with the sizes magnitudes to then get an exact size of what you want with the mesh Scale.

local OriginalSize = MeshPart:WaitForChild("OriginalSize")
local SizeValue = OriginalSize.Value

local OriginalMagnitude = SizeValue.Magnitude
local MeshMagnitude = MeshPart.Size.Magnitude

Mesh.Scale = (MeshMagnitude / OriginalMagnitude) / SizeValue

This should be the correct formula, if not you can switch things around with the division.

1 Like

Replies like this are annoying when you actually conduct a Google search and answers like this are in the SEO. If you have nothing constructive to add, don’t add.

3 Likes