I am using module 3d to do viewport frames, and I have different pets in my game. For some reason, each pet has a different size(refer to images below), is there a way to make all pets have the same graphical size?




you could use GetBoundingBox
local cframe, size = petModel:GetBoundingBox()
local position = cframe.Position
local offset = Vector3.new(size.X * 0.2, size.Y * 0.2, size.Z * 1.5)
viewportCamera.CFrame = CFrame.lookAt(position + offset, position)
In module 3d, i think it does it. I dont know a lot of cframe but this seems very similar
local BoundingCFrame,BoundingSize = Model:GetBoundingBox()
local ModelCenter = BoundingCFrame.p
--Determine the distance back.
local MaxSize = math.max(BoundingSize.X,BoundingSize.Y,BoundingSize.Z)
local DistanceBack = ((MaxSize/math.tan(math.rad(Camera.FieldOfView)))) * DepthMultiplier
local Center = CFrame.new(ModelCenter)
Camera.CFrame = Center * CFrameOffset * CFrame.new(0,0,(MaxSize/2) + DistanceBack)
Camera.Focus = Center
If you use that, it cannot be the same size. If you want the same size, you will have to choose whether you want things too small or too big to fit in the frame. You’d need a set offset to script that.
you can change viewport size option in camera
script.Parent.Camera.ViewportSize=Vector2.new(.8,.8)
wdym a set offset lol i dont know much about cframe tahts why i used module3d