BlockMesh
The BlockMesh object applies a 'brick' mesh to the BasePart it is parented to. It behaves identically to a SpecialMesh with SpecialMesh.MeshType set to 'brick'.
What does a BlockMesh do?
A BlockMesh gives the BasePart it was applied to a brick shaped mesh. It is identical in appearance to a standard Roblox Part.
The dimensions of the mesh will scale linearly in all directions with BasePart.Size, this means a part containing a BlockMesh can be resized the same way as any other part.
The additional functionality a BlockMesh brings however, is the ability to set the DataModelMesh.Scale and DataModelMesh.Offset properties. These allow the position and dimensions of the mesh that is displayed to be changed without changing the BasePart.Position or BasePart.Size of the BasePart the mesh is parented to.
Note as the BlockMesh object does not include a texture the DataModelMesh.VertexColor property does not do anything.
Code Samples
local part = Instance.new("Part")
part.Position = Vector3.new(0, 2, 0)
part.Size = Vector3.new(5, 2, 5)
part.Anchored = true
local mesh = Instance.new("BlockMesh")
mesh.Scale = Vector3.new(0.5, 0.5, 0.5)
mesh.Offset = Vector3.new(0, 2, 0)
mesh.Parent = part
local adornment = Instance.new("SelectionBox")
adornment.Adornee = part
adornment.Parent = part
part.Parent = workspace
Summary
Properties
Properties inherited from DataModelMeshThe Offset of a mesh determines the relative position from the BasePart.Position of a BasePart that the mesh will be displayed at.
The Scale of a mesh determines the size of the mesh relative to its original dimensions.
Changes the hue of a mesh's texture, used with FileMesh.TextureId.