How to position the camera in the middle of the model regardless of it's size

Hello everyone,

I’m making a script to position the camera inside the viewportframe to the center of the model automatically regardless of it’s size but I have no idea how I should do that. any help?

you can use GetBoundingBox to work out the size of the model and then zoom back based on the size

local cFrame, size = model:GetBoundingBox()
camera.CFrame = cframe + Vector3.new(0, 0, -size.Z / 2)

Do you want it to loon towards the model, or to be positioned inside the model itself?

In the case of the latter, which direction do you need it to look towards?

In the case of the former, how far away do you need it to be away from the model and what variable is used to store the desired actual position of the camera

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.