As a Roblox developer, it’s currently too difficult to figure out what makes up an object in the world programmatically, specifically geometry. When working with custom collision systems, or in general, anything that requires a sufficient amount of geometrical data, there is no reliable or in-game way to figure out what that actual geometry is. In particular, it’s hard to know the geometry of meshes, terrain, and perhaps unions too – typically it is trivial to find what makes up a “Part” or a wedge but not meshes. It might be possible to come up with some solution that works on simple meshes but it’s not trivial when working with non-simple meshes. I have yet to find a practical and efficient enough way of doing so. Most potential solutions are just hacky and unintuitive. For example, one might be able to download mesh data externally, parse it, then send it to a game/studio session through the HttpService. However, that would of course require meshes to be saved to the library as an asset, and in most cases isn’t at all practical. In very specific cases maybe you could utilize raycasting but that certainly wouldn’t scale well and would fall short of the actual solution.
In short, it would be quite helpful if there was API or a set of methods that would help us achieve this. In a theoretical sense there could be read-only methods of the base part class that would roughly look like:
BasePart:GetAllSurfaces() --- array: return all surfaces/faces of part
BasePart:GetAllVertices() --- array: return all vertices of part
it would essentially give us some information on a wedge, parts, and in particular meshes. These methods would allow us to read Mesh data at runtime. Which would be extremely useful in many different use cases.
There are quite a bit amount of use-cases for the proposed API–but here are some I’ve initially thought of:
Let’s say I were needing to make something–where I wanted to overlay a part on a meshes, surface how would I do that? Or more specifically, how would I do that efficiently or without troublesome workarounds. If I wanted to make a holographic effect of a mesh how would I achieve this? How would I achieve something like this without using tons of ray casts? Well, the methods I proposed above would in theory make it quite easy to do and allow it to be done with little to no manual effort.
Maybe a better example would be for intersection/collision tests. The touch events and
GetTouchingParts are nice and all but when wanting to create a custom algorithm for this and making it accurate for meshes is where it gets difficult. The proposed API would also make it much easier to do this as well.
Right now, my personal use case, while definitely niche, is that I need to get some info on meshes for custom navigation mesh generation. As far as I know, there is no way to do that in-game or in a plugin. As mentioned it might be possible to use external programs and software and whatnot, but to me, that’s pretty impractical. I also could again use ray casting, but I’d prefer not to do that either. it would make it much easier to be able to get info like this using a simple API method.
Here are some other use-cases, that other developers have mentioned:
Plugins like @iGottic’s Performant Builder would be able to support automatically “manipulating” mesh geometry. Such as a face removing feature. So, In the grand scheme of things, you would be able to break down a mesh and remake it with changes applied.
Grappling/placement systems would largely benefit from the flexibility of being able to interpret mesh data.
While I did not originally mention Terrian, I think if the feature were to be expanded to include terrain meshes, it would also open up a larger realm of possibilities.
I have a strong feeling that mesh data and other information on the geometry of objects is stored or can be grabbed from somewhere. While I’m not a roblox engineer, I don’t think that this would be too hard or impossible to implement.
Overall i think that this would both improve my development experience and others’ experience as well because it would allow the implementation of numerous algorithms, effects, and such. I would if it were implemented, thanks!
Older, Related request: (BasePart/Union/Mesh):GetVertices(bool relative = true)