Skip to content

geometry

Reads a BasePart’s collision mesh geometry (triangles, shape, world-space snapshot) and takes a snapshot of nearby resident terrain.

geometry.PartTriangles(part: Instance) -> { verts: {Vector3}, tris: {{number,number,number}}, cframe: CFrame, size: Vector3 } | nil

Returns the part’s collision mesh in part-local space as a vertex list and 1-based triangle index list, along with its CFrame and Size, or nil if the part has no readable geometry.

local mesh = geometry.PartTriangles(workspace.Baseplate)
if mesh then print(#mesh.verts, #mesh.tris) end

geometry.PartSnapshot(part: Instance) -> MeshHandle | nil

Builds a fresh MeshHandle of the part’s collision mesh transformed into world space at its current CFrame, useful for feeding draw.Wireframe or occlusion checks.

local snap = geometry.PartSnapshot(workspace.Baseplate)
if snap then draw.Wireframe(snap) end

geometry.PartShape(part: Instance) -> number | nil

Returns the part’s Enum.PartType value as an integer (0 Ball, 1 Block, 2 Cylinder, 3 Wedge, 4 CornerWedge), or nil if it could not be read.

local shape = geometry.PartShape(workspace.Ball)
print(shape) -- 0

geometry.TerrainSnapshot(options: { radius: number?, mc: boolean? }?) -> MeshHandle | nil

Returns a dual-contour mesh of the resident Terrain within radius studs of the active Camera (default radius 512, default mc true), or nil if there is no active Camera or engine.

local terrain = geometry.TerrainSnapshot({ radius = 256 })
if terrain then draw.Wireframe(terrain) end