Mesh
Creates and edits polygon geometry, skin weights, and morph targets.
Behavior
Mesh creates and edits polygon geometry, skin weights, and morph targets.
Summary
Creates a sphere mesh with the supplied radius and segment count.
Mesh.box(size: Vector3?): MeshCreates a box mesh with the supplied dimensions.
Mesh.cornerWedge(size: Vector3?): MeshCreates a corner-wedge mesh with the supplied dimensions.
Creates a cylinder mesh with the supplied radius, height, and segment count.
Mesh.fromPart(part: BasePart): MeshCreates a mesh from the supplied BasePart's geometry.
Creates an empty editable Mesh.
Creates a prism with the supplied side count, radius, and height.
Creates a pyramid with the supplied side count, radius, and height.
Mesh.wedge(size: Vector3?): MeshCreates a wedge mesh with the supplied dimensions.
CollisionUpdates: booleanWhether mesh edits automatically update collision geometry.
The number of polygon faces in the mesh.
SmoothingAngle: numberThe angular threshold used when smoothing adjacent faces.
The number of triangles after polygon triangulation.
The number of vertices in the mesh.
AddFace(vertices: {number}): numberAdds a polygon using the supplied vertex identifiers and returns its face identifier.
AddMorphTarget(name: string, deltas: { Vector3 } | buffer): ()Registers named per-vertex position offsets for a morph target.
AddTriangle(first: number, second: number, third: number): numberAdds a triangular face using three vertex identifiers and returns its face identifier.
Adds a vertex at a mesh-local position and returns its identifier.
AutoSkin(): ()Computes skin weights for the mesh's bound bones.
BevelEdges(edges: { { number } }, width: number, segments: number?): ()Bevels the supplied edges by the given width and segment count.
BindSkin(bones: { Attachment | BasePart }): ()Binds the supplied Attachments or Parts as bones for mesh deformation.
ClearSkin(): ()Removes skin bindings and weights from the mesh.
Clone(): MeshReturns an independent copy of the mesh.
Compact(): ()Compacts mesh storage after topology edits.
CutFace(face: number, from: number, to: number): numberSplits the specified face between the supplied vertex identifiers and returns the resulting face identifier.
Edit(edit: (mesh: Mesh) -> ()): ()Runs the callback with this mesh as a grouped edit operation.
ExtrudeFaces(faces: {number}, distance: number): tableExtrudes selected faces by the supplied distance and returns information about the resulting geometry.
FillHoles(): numberFills open boundaries and returns the number of holes filled.
Flip(): ()Reverses face winding and surface orientation.
GetEdges(): tableReturns the edges of the mesh as vertex-identifier pairs.
Returns the dimensions of the mesh's bounds.
GetFaceArea(face: number): numberReturns the area of the specified face.
GetFaceCenter(face: number): Vector3Returns the center of the specified face in mesh-local coordinates.
GetFaceEdges(face: number): tableReturns the edges forming the specified face.
GetFaceNormal(face: number): Vector3Returns the geometric normal of the specified face.
GetFaceNormals(face: number): { Vector3 }Returns the per-corner normals of the specified face.
GetFaceUVs(face: number): tableReturns the texture coordinates assigned to the specified face.
GetFaceVertices(face: number): tableReturns the vertex identifiers forming the specified face.
GetFaces(): tableReturns the face identifiers in the mesh.
GetFacesAlongEdge(edge: {number}): tableReturns the faces adjacent to the supplied edge.
GetFacesFacing(direction: Vector3, tolerance: number?): tableReturns faces whose normals face the supplied direction within the tolerance.
GetFacesTouching(vertex: number): tableReturns the faces containing the specified vertex.
GetMorphTargets(): { string }Returns the names of the registered morph targets.
GetMorphWeight(name: string): numberReturns the current weight of the named morph target.
GetPosedVertexPosition(vertex: number): Vector3Returns a vertex position after skin and morph deformation.
GetSharpEdges(angle: number?): tableReturns edges whose adjacent faces differ by more than the angle threshold.
GetSkinBones(): { string }Returns the names of the bones bound to this mesh.
GetSurfaceArea(): numberReturns the total area of the mesh surface.
GetVertexBuffer(first: number?, count: number?): bufferReturns a packed position buffer for the requested vertex range.
GetVertexPosition(vertex: number): Vector3Returns the mesh-local position of the specified vertex.
GetVertexPositions(first: number?, count: number?): { Vector3 }Returns mesh-local positions for the requested vertex range.
GetVertexWeights(vertex: number): { [string]: number }Returns bone-name-to-weight entries for the specified vertex.
GetVertices(): tableReturns the vertex identifiers in the mesh.
GetVolume(): numberReturns the volume computed from the mesh's oriented faces.
InsetFaces(faces: {number}, amount: number): tableInsets the selected faces by the supplied amount and returns the resulting geometry information.
Intersect(other: Mesh): ()Replaces this mesh with its solid intersection with another mesh.
IsClosed(): booleanReturns whether the mesh forms a closed surface.
IsFaceSmooth(face: number): booleanReturns whether the specified face uses smooth shading.
MergeByDistance(distance: number?): ()Merges vertices whose positions fall within the supplied distance.
MergeVertices(vertices: {number}): numberMerges the supplied vertex identifiers and returns the retained vertex identifier.
ProjectUVs(scale: number?): ()Generates projected texture coordinates using the supplied scale.
RemoveFace(face: number): booleanRemoves a face and returns whether it existed.
RemoveFaces(faces: {number}): numberRemoves the supplied faces and returns the number removed.
RemoveMorphTarget(name: string): ()Removes the named morph target.
RemoveVertex(vertex: number): numberRemoves the specified vertex and updates affected topology.
Multiplies mesh-local vertex positions by the supplied per-axis scale.
SetFaceNormals(face: number, normals: { Vector3 }?): ()Sets the per-corner normals for a face.
SetFaceSmooth(face: number, smooth: boolean): ()Enables or disables smooth shading for the specified face.
SetFaceUVs(face: number, uvs: { Vector2 }): ()Sets the per-corner texture coordinates for the specified face.
SetFaceVertices(face: number, vertices: { number }): ()Replaces the vertex sequence of the specified face.
SetMorphWeight(name: string, weight: number): ()Sets the blend weight of a named morph target.
SetSkinWeights(first: number, weights: { { [string]: number } }): ()Sets skin weights for a consecutive range of vertices.
SetSmooth(smooth: boolean): ()Enables or disables smooth shading across all faces.
SetVertexPosition(vertex: number, position: Vector3): ()Sets the mesh-local position of the specified vertex.
SetVertexPositions(first: number, positions: { Vector3 } | buffer): ()Writes consecutive vertex positions from a Vector3 array or packed buffer.
SetVertexWeights(vertex: number, weights: { [string]: number }): ()Sets the bone weights of the specified vertex.
Splits geometry with a plane defined by a point and normal and returns a Mesh.
SplitEdge(edge: {number}, along: number?): numberSplits an edge at the supplied fractional position and returns the new vertex identifier.
Subtract(other: Mesh): ()Replaces this mesh with its solid difference from another mesh.
Applies a CFrame to the mesh-local vertex positions.
Adds an offset to all mesh-local vertex positions.
Triangulate(): ()Converts polygon faces into triangles.
Union(other: Mesh): ()Replaces this mesh with its solid union with another mesh.
UpdateCollision(): ()Rebuilds collision geometry after mesh edits.
Constructors
ball
Mesh.ball(radius: number?, segments: number?): MeshCreates a sphere mesh with the supplied radius and segment count.
box
Mesh.box(size: Vector3?): MeshCreates a box mesh with the supplied dimensions.
cornerWedge
Mesh.cornerWedge(size: Vector3?): MeshCreates a corner-wedge mesh with the supplied dimensions.
cylinder
Mesh.cylinder(radius: number?, height: number?, segments: number?): MeshCreates a cylinder mesh with the supplied radius, height, and segment count.
fromPart
Mesh.fromPart(part: BasePart): MeshCreates a mesh from the supplied BasePart's geometry.
new
Mesh.new(): MeshCreates an empty editable Mesh.
prism
Mesh.prism(sides: number?, radius: number?, height: number?): MeshCreates a prism with the supplied side count, radius, and height.
pyramid
Mesh.pyramid(sides: number?, radius: number?, height: number?): MeshCreates a pyramid with the supplied side count, radius, and height.
wedge
Mesh.wedge(size: Vector3?): MeshCreates a wedge mesh with the supplied dimensions.
Properties
CollisionUpdates
Mesh.CollisionUpdates: booleanWhether mesh edits automatically update collision geometry. Disable during a batch of edits and call UpdateCollision afterward when needed.
FaceCount
Mesh.FaceCount: numberThe number of polygon faces in the mesh.
SmoothingAngle
Mesh.SmoothingAngle: numberThe angular threshold used when smoothing adjacent faces.
TriangleCount
Mesh.TriangleCount: numberThe number of triangles after polygon triangulation.
VertexCount
Mesh.VertexCount: numberThe number of vertices in the mesh.
Methods
AddFace
Mesh:AddFace(vertices: {number}): numberAdds a polygon using the supplied vertex identifiers and returns its face identifier.
AddMorphTarget
Mesh:AddMorphTarget(name: string, deltas: { Vector3 } | buffer): ()Registers named per-vertex position offsets for a morph target.
AddTriangle
Mesh:AddTriangle(first: number, second: number, third: number): numberAdds a triangular face using three vertex identifiers and returns its face identifier.
AddVertex
Mesh:AddVertex(position: Vector3): numberAdds a vertex at a mesh-local position and returns its identifier.
AutoSkin
Mesh:AutoSkin(): ()Computes skin weights for the mesh's bound bones.
BevelEdges
Mesh:BevelEdges(edges: { { number } }, width: number, segments: number?): ()Bevels the supplied edges by the given width and segment count.
BindSkin
Mesh:BindSkin(bones: { Attachment | BasePart }): ()Binds the supplied Attachments or Parts as bones for mesh deformation.
ClearSkin
Mesh:ClearSkin(): ()Removes skin bindings and weights from the mesh.
Clone
Mesh:Clone(): MeshReturns an independent copy of the mesh.
Compact
Mesh:Compact(): ()Compacts mesh storage after topology edits.
CutFace
Mesh:CutFace(face: number, from: number, to: number): numberSplits the specified face between the supplied vertex identifiers and returns the resulting face identifier.
Edit
Mesh:Edit(edit: (mesh: Mesh) -> ()): ()Runs the callback with this mesh as a grouped edit operation.
ExtrudeFaces
Mesh:ExtrudeFaces(faces: {number}, distance: number): tableExtrudes selected faces by the supplied distance and returns information about the resulting geometry.
FillHoles
Mesh:FillHoles(): numberFills open boundaries and returns the number of holes filled.
Flip
Mesh:Flip(): ()Reverses face winding and surface orientation.
GetEdges
Mesh:GetEdges(): tableReturns the edges of the mesh as vertex-identifier pairs.
GetExtent
Mesh:GetExtent(): Vector3Returns the dimensions of the mesh's bounds.
GetFaceArea
Mesh:GetFaceArea(face: number): numberReturns the area of the specified face.
GetFaceCenter
Mesh:GetFaceCenter(face: number): Vector3Returns the center of the specified face in mesh-local coordinates.
GetFaceEdges
Mesh:GetFaceEdges(face: number): tableReturns the edges forming the specified face.
GetFaceNormal
Mesh:GetFaceNormal(face: number): Vector3Returns the geometric normal of the specified face.
GetFaceNormals
Mesh:GetFaceNormals(face: number): { Vector3 }Returns the per-corner normals of the specified face.
GetFaceUVs
Mesh:GetFaceUVs(face: number): tableReturns the texture coordinates assigned to the specified face.
GetFaceVertices
Mesh:GetFaceVertices(face: number): tableReturns the vertex identifiers forming the specified face.
GetFaces
Mesh:GetFaces(): tableReturns the face identifiers in the mesh.
GetFacesAlongEdge
Mesh:GetFacesAlongEdge(edge: {number}): tableReturns the faces adjacent to the supplied edge.
GetFacesFacing
Mesh:GetFacesFacing(direction: Vector3, tolerance: number?): tableReturns faces whose normals face the supplied direction within the tolerance.
GetFacesTouching
Mesh:GetFacesTouching(vertex: number): tableReturns the faces containing the specified vertex.
GetMorphTargets
Mesh:GetMorphTargets(): { string }Returns the names of the registered morph targets.
GetMorphWeight
Mesh:GetMorphWeight(name: string): numberReturns the current weight of the named morph target.
GetPosedVertexPosition
Mesh:GetPosedVertexPosition(vertex: number): Vector3Returns a vertex position after skin and morph deformation.
GetSharpEdges
Mesh:GetSharpEdges(angle: number?): tableReturns edges whose adjacent faces differ by more than the angle threshold.
GetSkinBones
Mesh:GetSkinBones(): { string }Returns the names of the bones bound to this mesh.
GetSurfaceArea
Mesh:GetSurfaceArea(): numberReturns the total area of the mesh surface.
GetVertexBuffer
Mesh:GetVertexBuffer(first: number?, count: number?): bufferReturns a packed position buffer for the requested vertex range.
GetVertexPosition
Mesh:GetVertexPosition(vertex: number): Vector3Returns the mesh-local position of the specified vertex.
GetVertexPositions
Mesh:GetVertexPositions(first: number?, count: number?): { Vector3 }Returns mesh-local positions for the requested vertex range.
GetVertexWeights
Mesh:GetVertexWeights(vertex: number): { [string]: number }Returns bone-name-to-weight entries for the specified vertex.
GetVertices
Mesh:GetVertices(): tableReturns the vertex identifiers in the mesh.
GetVolume
Mesh:GetVolume(): numberReturns the volume computed from the mesh's oriented faces. Open or inconsistently oriented geometry may not describe a closed solid.
InsetFaces
Mesh:InsetFaces(faces: {number}, amount: number): tableInsets the selected faces by the supplied amount and returns the resulting geometry information.
Intersect
Mesh:Intersect(other: Mesh): ()Replaces this mesh with its solid intersection with another mesh.
IsClosed
Mesh:IsClosed(): booleanReturns whether the mesh forms a closed surface.
IsFaceSmooth
Mesh:IsFaceSmooth(face: number): booleanReturns whether the specified face uses smooth shading.
MergeByDistance
Mesh:MergeByDistance(distance: number?): ()Merges vertices whose positions fall within the supplied distance.
MergeVertices
Mesh:MergeVertices(vertices: {number}): numberMerges the supplied vertex identifiers and returns the retained vertex identifier.
ProjectUVs
Mesh:ProjectUVs(scale: number?): ()Generates projected texture coordinates using the supplied scale.
RemoveFace
Mesh:RemoveFace(face: number): booleanRemoves a face and returns whether it existed.
RemoveFaces
Mesh:RemoveFaces(faces: {number}): numberRemoves the supplied faces and returns the number removed.
RemoveMorphTarget
Mesh:RemoveMorphTarget(name: string): ()Removes the named morph target.
RemoveVertex
Mesh:RemoveVertex(vertex: number): numberRemoves the specified vertex and updates affected topology.
Scale
Mesh:Scale(factor: Vector3): ()Multiplies mesh-local vertex positions by the supplied per-axis scale.
SetFaceNormals
Mesh:SetFaceNormals(face: number, normals: { Vector3 }?): ()Sets the per-corner normals for a face. Passing nil clears the override.
SetFaceSmooth
Mesh:SetFaceSmooth(face: number, smooth: boolean): ()Enables or disables smooth shading for the specified face.
SetFaceUVs
Mesh:SetFaceUVs(face: number, uvs: { Vector2 }): ()Sets the per-corner texture coordinates for the specified face.
SetFaceVertices
Mesh:SetFaceVertices(face: number, vertices: { number }): ()Replaces the vertex sequence of the specified face.
SetMorphWeight
Mesh:SetMorphWeight(name: string, weight: number): ()Sets the blend weight of a named morph target.
SetSkinWeights
Mesh:SetSkinWeights(first: number, weights: { { [string]: number } }): ()Sets skin weights for a consecutive range of vertices.
SetSmooth
Mesh:SetSmooth(smooth: boolean): ()Enables or disables smooth shading across all faces.
SetVertexPosition
Mesh:SetVertexPosition(vertex: number, position: Vector3): ()Sets the mesh-local position of the specified vertex.
SetVertexPositions
Mesh:SetVertexPositions(first: number, positions: { Vector3 } | buffer): ()Writes consecutive vertex positions from a Vector3 array or packed buffer.
SetVertexWeights
Mesh:SetVertexWeights(vertex: number, weights: { [string]: number }): ()Sets the bone weights of the specified vertex.
Slice
Splits geometry with a plane defined by a point and normal and returns a Mesh.
SplitEdge
Mesh:SplitEdge(edge: {number}, along: number?): numberSplits an edge at the supplied fractional position and returns the new vertex identifier.
Subtract
Mesh:Subtract(other: Mesh): ()Replaces this mesh with its solid difference from another mesh.
Transform
Mesh:Transform(cframe: CFrame): ()Applies a CFrame to the mesh-local vertex positions.
Translate
Mesh:Translate(offset: Vector3): ()Adds an offset to all mesh-local vertex positions.
Triangulate
Mesh:Triangulate(): ()Converts polygon faces into triangles.
Union
Mesh:Union(other: Mesh): ()Replaces this mesh with its solid union with another mesh.
UpdateCollision
Mesh:UpdateCollision(): ()Rebuilds collision geometry after mesh edits.
Operators
__tostring · __type
Used by
BasePart · GeometryPart · IntersectOperation · NegateOperation · Part · Seat · SpawnLocation · UnionOperation · VehicleSeat