Making a part fit a viewportframe

So I have a custom inventory system for a game of mine in which I want for each slot to have a viewportframe and if that slot has a certain item, its model shows up in that viewportframe

This is the system I currently have, everything works fine except for one thing, the models positioning. Since models have different sizes I use this for positioning the models in front of the viewport frame:

local calculatedpos =,0,-(model.Size.Z * 3.5))

Now this works well most of the time. Here is the issue Iā€™m having:
The stick models position is fine but as you can see, the rock and especially the rope models are positioned too far from the frame. This is mostly due to the fact that the rope has a larger size on the Z axis compared to X and Y.

You can change the cameras FieldOfView like so (changes the FOV to 60):

{camera}.FieldOfView = 60

Although I think that the problem could be resolved with changing the FieldOfView based on the z axis.

1 Like

Alright so with a few tweaks to the math I now have a position template that works with all of the current items

local calculatedpos =,0,-1 - model.Size.Y / 10)