MeshPart:GetOriginalSize()

meshparts

#1

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.


#2

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.


#3

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


#4

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.


#5

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


#6

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.


#7

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!


#8

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.


#9

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.