How to find center of a model?

Hi. I would like to find the center/middle of an object that contains folders, meshes, parts etc. I would just like to find the middle of that model.

But when I click the model there is no “Position” property. Is there any way of finding the center position values of that object? Thanks. Feel free to ask more questions.

6 Likes

Use hinge surfacetype and it will show you exactly where the center is.


On this picture if you look closely on the hinges it is exactly in the middle of the cylinders.

4 Likes

What I do is that I un-model the model and union the model. This why, I get the position.

https://developer.roblox.com/en-us/api-reference/function/Model/GetBoundingBox

Model has a function Model:GetBoundingBox(), you can use this to get the center of the model.

local model = workspace.Model
local part = workspace.center
local orientation = model:GetBoundingBox()
part.CFrame = orientation

“Orientation” returns a CFrame value, you can convert this to a Vector3 value by doing CFrame.p (or in this case, orientation.p)

11 Likes

Thanks. But I do not fully understand what “part” is. Since I have defined the model, but what is the “part”?

Could you give me an example?
If you were to do it with a model called “Test” in workspace.

The “part” isn’t really necessary, I just put that in there to indicate and move the part to the model’s center.
image

You can just do

local model = workspace.Model
local orientation = model:GetBoundingBox()
print(orientation)

to print the CFrame position of the center of the model, you can convert it to Vector3 by doing orientation.p

14 Likes