Class · inherits TriangleMeshPart
MeshPart
A form of BasePart that includes a physically simulated custom mesh.
About MeshPart
MeshPart is a form of BasePart that includes a physically
simulated custom mesh. Unlike with other mesh classes, such as
SpecialMesh and BlockMesh, they are not parented to a
BasePart but rather behave as a BasePart in their own right.
The mesh and texture of a MeshPart are determined by the
MeshId and TextureID
properties. For more information, see Meshes.
Properties 7
DoubleSided
: booleanDetermines whether to render both faces of polygons in the mesh.This property determines whether to render both faces of polygons in the mesh. This is useful for meshes that are typically modeled as "cards" such as a leaf, hair, or cloth.
HasSkinnedMesh
: booleanHiddenIndicates whether the mesh currently applied to theMeshPartcontains skinning (bone and joint) data.Indicates whether the mesh currently applied to the
MeshPartcontains skinning (bone and joint) data, such as a mesh authored with an armature for skeletal deformation.Defaults to
false. The engine sets this automatically when a mesh is loaded (truewhen the mesh data includes joints), so scripts cannot set it.MeshContent
: ContentThe mesh that is displayed on theMeshPart. Supports asset URIs andEditableMeshobjects.The mesh that is displayed on the
MeshPart. Supports asset URIs andEditableMeshobjects.Note that this property cannot be changed directly by scripts, as the collision geometry of the mesh cannot be recomputed in real time. See
AssetService.CreateMeshPartAsyncas a method to create a newMeshPartfrom a givenContentwith a specifiedCollisionFidelity.MeshPart.ApplyMeshcan be used to overwrite theMeshContent,TextureContent, and collision geometry of an existingMeshPart.MeshId
: ContentIdThe asset URIs of the mesh that is displayed on theMeshPart. Reads and writes toMeshContent.The asset URIs of the mesh that is displayed on the
MeshPart. Reads and writes toMeshContent.Note that this property cannot be changed directly by scripts, as the collision geometry of the mesh cannot be recomputed in real time. See
AssetService.CreateMeshPartAsyncas a method to create a newMeshPartfrom a givenContentwith a specifiedCollisionFidelity.MeshPart.ApplyMeshcan be used to overwrite theMeshContent,TextureContent, and collision geometry of an existingMeshPart.RenderFidelity
: RenderFidelityNotReplicatedThe level of detail used to render theMeshPart.This property determines the level of detail that the
MeshPartwill be shown in. It can be set to the possible values of theRenderFidelityenum.The default value is
Automatic, meaning the mesh's detail is based on its distance from the camera as outlined in the following table.TextureContent
: ContentThe texture applied to theMeshPart. Supports asset URIs andEditableImageobjects.The texture applied to the
MeshPart. Supports asset URIs andEditableImageobjects.When this property is set to
Content.none, no texture will be applied to the mesh.local Workspace = game:GetService("Workspace") local meshPart = Workspace.MeshPart meshPart.TextureContent = Content.none -- No textureNote that the
MeshContentproperty cannot be directly changed during runtime but the texture can.Changing a Mesh Texture
Using the
TextureContentproperty, the texture of a mesh can be changed without having to re-upload the mesh. To do this, a new image can be uploaded to Roblox with the desired texture. The original texture image file can be obtained by exporting the mesh using the Export Selection option in Studio. The image file will be saved alongside the exported.objfile.The new texture can then be uploaded to Roblox as a decal and its asset URI can be applied to the mesh using the
TextureContentorTextureIDproperty.TextureContentcan also be set to reference anEditableImagethat has not been published yet.local AssetService = game:GetService("AssetService") local Workspace = game:GetService("Workspace") local meshPart = Workspace.MeshPart local editableImage = AssetService:CreateEditableImageAsync(meshPart.TextureContent) meshPart.TextureContent = Content.fromObject(editableImage) -- Live updatesWhen
TextureContentreferences anEditableImage, the texture will live update with any edits to theEditableImageobject.Making a Textured Mesh
A mesh can only be textured if the mesh has been UV mapped, referring to the practice of projecting a texture map onto a mesh. This cannot be done using Roblox Studio and must be done using an external 3D modeling application such as Blender.
TextureID
: ContentIdThe texture applied to theMeshPart. Reads and writes toTextureContent.The texture applied to the
MeshPart. Reads and writes toTextureContent.When this property is set to an empty string, no texture will be applied to the mesh.
local Workspace = game:GetService("Workspace") local meshPart = Workspace.MeshPart meshPart.TextureID = "" -- No textureNote that the
MeshPart.MeshIdproperty cannot be changed during runtime but the texture can. SeeTextureContentfor details.
Methods 1
ApplyMesh
(meshPart: Instance) → ()Overwrites theMeshContent,TextureContent, and collision geometry properties of thisMeshPartfrom the given sourcemeshPart.Overwrites the
MeshContent,TextureContent, and collision geometry properties of thisMeshPartfrom the given sourcemeshPart.Most of these properties are read-only and cannot be changed during runtime on their own directly. To keep
MeshContentand physics data in sync, they must be updated together.Copies the following properties:
MeshPart.MeshContent(implicitly updatesMeshId)MeshPart.TextureContent(implicitly updatesTextureID)MeshPart.RenderFidelityMeshPart.CollisionFidelity(with any internal collision geometry)MeshPart.FluidFidelity(with any internal aero geometry)MeshPart.MeshSize
MeshPart also has every member of TriangleMeshPart. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.