Rotatable models in images?

I have been wondering how people do this. If it’s view port frames, how do I get a perfect camera angle? All help is appreciated, thank you!

2 Likes

I don’t have much experience with this field; but I do believe it uses Coordination Frame (CFrame).

But… how do you display the models onto the images if you only use cframes?

As said before, I don’t have much experience with this. But it is possible. Try searching the internet for examples or scripts.

here use this script I made it work good and left comments should work if you follow steps

Local script:

–not my script but edited be me
–put code in a local script then put local script as a child of your viewportframe

local ViewportCamera = Instance.new(“Camera”,script)
ViewportCamera.CameraType = Enum.CameraType.Scriptable

local YInt = 10
local XInt = 3 – how far away the camera is from the object change to a larger number if you have a large object

local R = 0

local Item = script.Parent:WaitForChild(“part3”)–your part that is a child of viewportframe

local ViewportPoint = Vector3.new(0,0,0)

local ViewportFrame = script.Parent

ViewportFrame.LightDirection = Vector3.new(0,1,0)

ViewportFrame.Ambient = Color3.fromRGB(255,255,255)

ViewportFrame.CurrentCamera = ViewportCamera

Item.PrimaryPart = Item:FindFirstChild(“Part1”) – make sure you have a part the model your using named Part1 for the PrimaryPart and then it should work!

Item:SetPrimaryPartCFrame(CFrame.new(ViewportPoint))

game:GetService(“RunService”).RenderStepped:Connect(function()
local cframe, size = Item:GetBoundingBox()

local max = math.max(size.X,size.Y,size.Z)

local distance = (max/math.tan(math.rad(ViewportCamera.FieldOfView))) * XInt

local CurrentDistance = (max/2) + distance

ViewportCamera.CFrame = CFrame.Angles(0,math.rad(R),0) * CFrame.new(ViewportPoint + Vector3.new(0,0,CurrentDistance),ViewportPoint)

R = R + 1

end)

This should help:

1 Like