Skip to content

mesh

Read mesh geometry (vertices and faces) for MeshParts, from cached URLs or by resolving a MeshPart instance.

mesh.List() -> {string, ...}

Returns an array of all mesh content URLs currently known in the engine’s mesh cache.

for _, url in ipairs(mesh.List()) do
print(url)
end

mesh.Get(urlOrId: string) -> {url: string, vertices: {{x: number, y: number, z: number}, ...}, faces: {{number, number, number}, ...}} | nil

Fetches a mesh snapshot by exact cache URL, or by numeric asset id which matches any cached URL containing id=; returns nil if not found.

local m = mesh.Get("rbxassetid://123456789")
if m then
print(#m.vertices, #m.faces)
end

mesh.OfPart(part: Instance) -> {url: string, vertices: {{x: number, y: number, z: number}, ...}, faces: {{number, number, number}, ...}} | nil

Resolves the MeshId URL of a MeshPart instance and returns its mesh snapshot, or nil if the URL is empty or not in the cache.

local part = workspace.SomeMeshPart
local m = mesh.OfPart(part)
if m then
print(m.url)
end

mesh.PartUrl(part: Instance) -> string

Returns the raw resolved mesh content URL of a MeshPart instance, or an empty string if it has none; useful to distinguish a missing URL from a URL not yet in the cache when mesh.OfPart returns nil.

local url = mesh.PartUrl(workspace.SomeMeshPart)
if url == "" then
print("no mesh url")
end