local initAngle = CFrame.new(Vector3.new(), Vector3.new(-0.5, -0.4, -0.5)) function getCameraOffset(fov, targetSize) local x, y, z = targetSize.x, targetSize.y, targetSize.Z local maxSize = math.sqrt(x^2 + y^2 + z^2) local fac = math.tan(math.rad(fov)/2) local depth = 0.5*maxSize/fac return depth+maxSize/2 end model3D:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-0.5, -0.4, -0.5).unit*(getCameraOffset(camera.FieldOfView, model3D:GetExtentsSize())*0.85))) runService:BindToRenderStep('CameraRotation', Enum.RenderPriority.Camera.Value + 1, function() rotation = (rotation + 1 < 360 and rotation + 1 or 0) camera3D.CFrame = model3D.PrimaryPart.CFrame*CFrame.Angles(0, math.rad(rotation), 0) end)
So let me explain. initAngle is the angle the Camera.CFrame is set to as the default. Model3D is the model being put in the ViewPortFrame. What can’t change is that initAngle and the Model3D PrimaryPart position, or the getCameraOffset function. The line that should be getting changed is this
camera3D.CFrame = model3D.PrimaryPart.CFrame*CFrame.Angles(0, math.rad(rotation), 0)
But I’m not sure how to include the initAngle to this, so the part is actually a distance away.
So for the the 3 frames you see, the camera is set to the initAngle. When I hover over them it brings up the frame which has the viewport in it and the rotating image, however the model appears too big. I tried going
*CFrame.new(0, 0, 10)
at the end, but that just makes the smaller models too small and larger models still too big, so the point of setting the models PrimaryPart was to use GetExtentsSize so that way all the models look the same size