A MeshPart, is a physically simulated mesh that supports the upload of custom meshes with its MeshId property.
This page will explain everything you need to know about MeshParts, and how to start using them!
To add a mesh, you will first need to insert a MeshPart. To do this, right click in the Workspace, select
Insert Object and the select
This will insert a new part in the game with a simple placeholder mesh:
To insert a mesh into a MeshPart select the MeshPart and then find the MeshId property. To insert a mesh from a file, select the insert button next to the MeshId property. This will open a file dialog where you can select a local .fbx file to import.
Alternatively, if you know the assetID of the mesh you want to use, you can enter it into the MeshId field.
You can also insert a mesh through the game explorer. To do this, first make sure your game is published. Then, in the Game Explorer panel, right click on Assets and select Add Mesh.
After a mesh has been added to the Game Explorer, a copy of the mesh can be inserted into the game by double-clicking on it in the Game Explorer or by right clicking on it and selecting Insert.
An fbx file can define a path to a texture for a mesh. If this is set in an fbx file that is used when uploading a mesh and the path is valid, the texture will automatically be uploaded and inserted when the mesh is inserted.
If the mesh was not inserted with a texture automatically, a custom texture can be applied to a MeshPart by setting its TextureID. Unlike the MeshId, the TextureID can be set either in Studio or at run time through a script. Like other instances that use TextureIDs, the asset id for the mesh’s texture can be set in a number of ways. Firstly, if you know the numerical id for the texture, you can set the id with the number and the prefix “rbxassetid://”:
If your place is published you can also upload the texture to the Game Explorer. There are two ways to do this. The first is to right click on Assets in the Game Explorer and select either Add Image or Add Multiple Images
Alternatively you can click on the TextureID field of a MeshPart’s properties and upload an image file to use through the dialog that pops up.
Like UnionOperations, MeshParts have a CollisionFidelity. This setting determines how closely the visual representation of the object matches the physical bounds of the object. See CollisionFidelity for more information.
There are several limitations on uploading meshes that one should be aware of:
- The MeshId of a MeshPart cannot be changed at runtime with a script.
- A mesh can have a maximum of 5000 polygons.
- Meshes cannot be unioned with Solid Modeling.
- Like images and sounds, all meshes will go through moderation before they are visible to other users.