Get Center CFrame of a model

I vaguely remember at some point during my time on ROBLOX Studio a method to get the central position of a Model. I may be imagining this or I have forgotten it. My goal is this: I have a tunnel that I want to be able to rotate (with contents inside) by 90 degrees through its center.
How can I get the center CFrame or Position of a model?

2 Likes

GetModelCFrame() was deprecated a few years ago, but as far as I know, it’s still functional, and there really aren’t any good alternatives other than manually assigning a PrimaryPart to each model at its center.

1 Like

You can simply use the GetBoundingBox() function of a model, which will return its size and cframe. You won’t even need to set its PrimaryPart. Apply it as such:

local model = workspace.Model
local part = workspace.Part
local orientation, size = model:GetBoundingBox()
part.Size = size
part.CFrame = orientation
15 Likes

Thanks! I thought GetBoundingBox() was something completely different, it seems to give off the same position elements as the GetModelCFrame() method, since that was deprecated I’ll use this one.
p.s. sorry for late reply

1 Like