MeshPart

Show Deprecated

MeshParts are 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 MeshPart.MeshId and MeshPart.TextureID properties. For more information, see Meshes.

SpecialMesh or MeshPart?

There are currently two ways of using a developer created mesh. They are using a SpecialMesh with the SpecialMesh.FileType set to 'FileMesh', or by using a MeshPart. Although, on the whole, the MeshPart object has superseded the SpecialMesh there are some differences developers should be aware of.

In most, but not all cases, using a MeshPart is more suitable. As MeshParts are a relatively new feature however, developers should expect some of the above behaviour to change.

Summary

Properties

Render both faces of polygons in the mesh.

The MeshId is the content ID of the mesh that is to be displayed on the MeshPart.

READ ONLY
NOT REPLICATED

Determines the level of detail that solid-modeled and mesh parts will be shown in.

NOT REPLICATED

The texture applied to the MeshPart.

Events

Methods

ApplyMesh(meshPart: Instance): nil  


Properties

DoubleSided

This property determines whether to render both faces or polygons in the mesh. It is only changeable in Studio. This is useful for meshes that are typically modeled as cards such as a leaf, hair and cloth.

Example: The tree leaves are modeled with single sided cards. Leaves as cards

With MeshPart.DoubleSided disabled some leaves are missing since they are back facing the camera. DoubleSided property disabled

With MeshPart.DoubleSided enabled, both faces of the leaves are rendered. DoubleSided property enabled

MeshId

The MeshId is the content ID of the mesh that is to be displayed on the MeshPart.

Note that this property currently cannot be changed by scripts as the collision model of the mesh cannot be recomputed during runtime. Developers should not rely on this behavior as it may change in the future. Those looking for a custom mesh object that can be updated during runtime should use SpecialMesh.

MeshSize

Read Only
Not Replicated

RenderFidelity

Not Replicated

This property determines the level of detail that solid-modeled and mesh parts will be shown in and can be set to the possible values of the RenderFidelity enum.

By default, solid-modeled and mesh parts will always be shown in precise fidelity, no matter how far they are from the game camera. This improves their appearance when viewed from any distance, but if a place has a large number of detailed solid-modeled or mesh parts, it may reduce overall game performance.

Distance From CameraRender Fidelity
Less than 250 studsHighest
250-500 studsMedium
500 or more studsLowest

TextureID

The texture applied to the MeshPart. When this property is set to an empty string, no texture will be applied to the mesh.


1MeshPart.TextureID = "" -- no texture
2

Note, although the MeshPart.MeshId property cannot be changed during runtime, the texture can.

How can I change the texture of a mesh?

Using the TextureId property, the texture of a mesh can be changed without having to reupload the mesh. To do this, a new image will need to 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 Roblox Studio. The image file will be saved alongside the exported .obj file.

The new texture can then be re-uploaded to Roblox as a Decal and its content ID can be applied to the mesh using the TextureId property.

How can I make a textured mesh?

A mesh can only be textured if the mesh has been UV mapped. UV mapping refers to the practice of projecting a texture map onto a mesh. This cannot be done using Roblox Studio and has to be done using an external 3D modelling application such as Blender.

Events

Methods

ApplyMesh

Parameters

meshPart: Instance

Returns