Hello! I’m currently working on a project where I need to be able to position the camera within a viewport frame in a similar manner to that of the roblox marketplace; however, I have been unable to do so as I am unable to achieve the correct positioning and orientation.
Here is the code I am currently using:
local Cam = Instance.new("Camera")
Cam.CameraType = Enum.CameraType.Scriptable
Cam.Parent = View
local Scale = Obj:GetExtentsSize().Magnitude
Scale = math.pow(Scale, 0.5) -- Square rooted because it was too far away otherwise
Cam.CFrame = CFrame.lookAt(Obj:GetPivot().Position+(Vector3.new(-1,.5,-1.5)*Scale), Obj:GetPivot().Position)
This is what that code produces:
My Result:
Goal (Marketplace Image)
My Result
Goal (Marketplace Image)
If you have any idea how I can correct this, please let me know! Anything is appreciated.
Thanks for reading
Merry Christmas!