MeshPart:GetOriginalSize()

As a Roblox developer, it is currently too hard to convert MeshParts to SpecialMeshes via script at runtime.

The .05 minimum Size (along each axis) was recently applied to MeshParts. Meshes rendering at smaller sizes was useful for things like rendering objects close to the camera while producing the effect that they are larger and farther away (e.g. 3D UI, guns in a FPS, etc.) without them clipping into walls.

The best workaround right now is to replace those MeshParts with Parts containing a SpecialMesh and setting the Scale accordingly, but to do so from a script at runtime requires knowing the “original size” of the MeshPart. The only way to figure these out is by hand (paste MeshId into blank MeshPart). This would mean that if I wanted to be able to hot swap between the two via script, I have to keep a table somewhere containing the original size of every MeshId I am interested in scaling, and keep that table up-to-date manually.

Plugin access to set MeshId would allow us to make a database that automatically updated, but unfortunately MehsPart.MeshId is completely restricted.

What I am proposing is a new function, MeshPart:GetOriginalSize(). It would tell you the “original size” of the MeshPart, the Size it would be set to if you took a blank MeshPart and set its MeshId.

A side benefit (I think) is that this could also clean up R15 characters a bit, as every MeshPart in them has a Vector3Value named “OriginalSize”. I don’t know much about that, though.

If Roblox is able to address your issue, how would it improve your game and/or your development experience?

The process of converting between MeshParts and SpecialMeshes would be more streamlined, and getting MeshParts small enough for these particular use cases would become possible again.


If anyone knows any tricks that could help, please let me know. Otherwise, I think this feature would be pretty handy.

41 Likes

Copy the meshpart size and transfer that over to a part with a special mesh inside. Then paste the id in the filemesh id property.

1 Like

SpecialMesh Scale is a multiplier of the mesh’s original size. You can’t calculate multiplier from current size without knowing the original size.

@OP you should be able to get original size by inserting the MeshPart with InsertService. SpecialMesh.Scale = MeshPart.Size/insertedMeshPart.Size

6 Likes

I appreciate the tip! I did not consider this as an option. I would certainly be able to use this in a Plugin to automatically keep a database of MeshPart original sizes

however

not all of the MeshParts in my game are uploaded or owned by me. I will therefore receive HTTP 403 (HTTP/1.1 403 Asset is not trusted for this place) when attempting to load them using InsertService.

Do you have any advice for working around this? It seems we may still need the aforementioned API addition in order to solve this problem.

2 Likes

Im saying you can keep a table of the original mesh sizes which can then be kept with the parts size and SpecialMesh scale of 1,1,1

1 Like

We still need this feature. Can we please implement something that will allow us to get the OriginalSize of any MeshPart at runtime? We cannot convert MeshParts to SpecialMeshes without this.

3 Likes

Reluctant to post this as its super hacky and isn’t a proper solution, but it is possible to do this currently. I use this method for my rendering stuff:

  1. Download the mesh asset through http + proxy;
  2. Parse the mesh file for vertices;
  3. Construct AABB and measure its size.

Nevertheless, I agree that this would be a neat feature!

3 Likes

I have considered this, but I haven’t found a reliable/trusted proxy that stays up more than a couple months.

Edit: tbh I just don’t want to have to trust anybody else’s proxy that I know nothing about.

3 Likes

Ran into this now, and the solution I suggested earlier is not possible. The MeshId is a RenderMesh and can’t be inserted into the game. I need this for a similar reason to the OP: my footprint meshes must be sizeY=0, so I’m forced to use special meshes. I have to make sure they match the size of the character’s feet they came from, but there’s no way for me to do that since I don’t necessarily know their original size.

Even Roblox uses hacks (Vector3Values with original size stored in avatar MeshParts), so this would be a welcome feature.

7 Likes

As a Roblox developer, it is currently impossible to determine the native size of a MeshId.


If you you look at this picture, you’ll see that there are two parts that are the same size, with meshes that are the same scale, yet the sword is much larger than the hair.

This is because the native size of the sword, is much bigger than the native size of the hair. However, there does not seem to be a way to determine the native size of a mesh.

If Roblox is able to address this issue, it would improve my game because

I would be able to allow players to insert their very own meshes with restrictions! So that players don’t have swords the size of skyscrapers. This would encourage immersion, creativity, and fun for users across the platform.


Solution:

GetNativeSize()

Returns a Vector3 value equal to the size of the original Mesh Object’s size.

local part = game.Workspace.Part
local mesh = part.SpecialMesh
local nativeSize = mesh:GetNativeSize()
print(nativeSize)

As a side note, MeshParts do not fix this problem because you cannot edit the MeshId of a MeshPart during Runtime.
image
As of right now, the only way I could use this as an alternative would be for me to manually create a MeshPart for every single mesh possible to use for customization.

9 Likes

Hello! Lately, I have been working on a roleplay game where the players are meant to make their own avatars using Meshes and Images.

The idea :

  • Player provides Mesh and Decal IDs to make their own custom avatars.
  • The provided ID’s will change Decals and SpecialMeshes in the character’s arms, torso, and head.

The problems:

  • Library IDs are not the same as AssetIDs
  • SpecialMeshes use Scale values instead of Size values, making resizing tough.

Is there any way to automatically change a SpecialMesh Scale to match the size of its parent? Is there any way to retrieve an AssetID from a Library ID?
Thanks!

1 Like

I need this. I’m working on a script that produces outlines around parts, however it runs into issues with SpecialMeshes since I am adding 0.3 to create the outline. If I knew the original size of the mesh, I would be able to do a little math to get the relative size. My only workaround is to not support SpecialMeshes at all lol

6 Likes

Surprising that this isn’t a feature yet as it would useful for being able to “Serialize and Deserialize” MeshParts properly as you can not set MeshId during runtime and SpecialMeshes scales are all over the place.

An API equivalent to the original request has been implemented by Roblox as the MeshPart.MeshSize property.

3 Likes