Wrap Model to MeshPart Plugin | Reduce Experience Lag & Instance Count!

Hello friends, I recently created a simple plugin that allows you to wrap a model into a MeshPart with a click of a button! No more trying to size meshparts with models (it’s annoying and takes forever).

This plugin helps reduce lags and instance counts!

Here’s how to use it

image

  • 4, You should see that it inserted a MeshPart to the exact model size!
    Now upload your model into a MeshPart using the directions listed below


    Save the model in a location that you will remember!

  • 5, This step is optional, but you can delete the model

  • 6, Click on the MeshPart that was inserted, and go to your “Properties” panel, next go to "MeshID"
    image
    Click on the Folder icon with the GREEN arrow
    Then select the mesh that you just exported (step 4)

Select “NO”, and wait a couple of seconds (depending on how big your model is)

You should then have you model, you can only color it and change the material if it was single part, unless you have a texture
image


I hope this helped, I know it’s a simple plugin but it can save many a lot of time!

8 Likes

If you’re wondering what the source-code is, and don’t have BT-Roblox to view it, it’s listed below. I just ask that you don’t reupload it or claim it as your own.
.

-- [*] A VERY simple plugin that saves a LOT of time!
-- PlasmaRBLX; <3

-- || Services
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local SelectionService = game:GetService("Selection")

local TB = plugin:CreateToolbar("Model Tools")
local WrapButton = TB:CreateButton("Wrap Model", "Wrap Model To MeshPart", "rbxassetid://167300717")

WrapButton.ClickableWhenViewportHidden = false

WrapButton.Click:Connect(function()
	for index, model in pairs(SelectionService:Get()) do
		if model:IsA("Model") then
			local NewPart = Instance.new("MeshPart")
			local M_Size = model:GetExtentsSize()
			NewPart.Size = M_Size
			NewPart.CFrame = model:GetBoundingBox()
			NewPart.Parent = workspace
		end
	end
end)

I’m planning on making an update that allows you to use Parts instead of MeshParts (For barriers like cars, so players can jump of them), but for now it’s just going to be a simple plugin.

If I have extra time or this gets attention it will be added!

FYI: You can also insert the plugin into workspace with InsertService to view the code

Yeah, but some don’t understand that!

1 Like

converting parts & unions does not help with performance as you get the same or higher tris count

Yup, I didn’t do any test with this plugin to see if it actually reduces lag (it sure reduces instance count but ​at some cost).

​The reason of why many people say meshes can help reducing lag (and is true) is because they’re usually made in external apps like Blender which are specially designed to modify even that little and nearly invisible spot. For instance, making a cup of tea in blender is much better for performance than making it out of parts in the form of a union in roblox, why?

Because, if you know how to use blender, you’ll probably be able to accurately modify the cup to get rid of all the unnecessary triangles and faces that you don’t need or see. By the other hand roblox’s csg engine will just get everything together and do its best to optimize it, but the results aren’t nearly as accurate as optimizing meshes by hand.

And finally two quick reminders:

  • Roblox’s default BaseParts have been here with us since years, literally they where the only way of building back then, so expect them to be the most performance-friendly baseparts you can find out there in-studio.

  • Meshes can be or can not be your best friend when building or modelling. By default meshes will have more cost than normal base parts when loading and they affect performance more than a simple brick or wedge. Meshes are useful for those cases where you need to make something with high detail, something complex or something really big like a whole map to avoid using lots of parts or, unions…

    Having to pay 1 tax is better than having to pay 10 taxes but only if that one tax costs less than the 10 taxes together.

Some amazing topics talking about the topic:

(More a discussion topic than a resource one)

3 Likes

I was summoned here due to somebody linking my plugin, Performant Builder, which converts parts to meshes + allows for additional geometry types, smooth shading, poly modifications, etc.

I don’t want to come off as putting you or the resource down, but I have to let you know this is an insufficient resource. I’ll explain why.

First off, meshes versus parts only work when comparing with just a few triangles. For example, a mesh part block will be more performant than a part in Roblox, and this is easy to state, since it’s a rectangular prism.

However, with more complex geometry, you are assuming the topology of a model will be pretty when it’s made by Roblox: it’s simply not.

Roblox triangulates everything, meaning instead of allowing quads and n-gons, everything must be made of triangles. Unfortunately, they don’t do it well, so if something is not pre-triangulated, it will do it for you. In your example with crates, I can assume a mass of overlapping vertices and edges. This causes lag.

The best practice for more complex geometry is to make it in Blender, Maya, Cinema 4D, etc. These tools allow you to make the model in an optimized manner.

Side note, I’m not sure why you would need a block to export the model. It doesn’t make sense, and in itself, seems redundant.

5 Likes