Object preview in ViewportFrame

How would I make a system for previewing items in viewport frames?

I currently have a script that just rotates around the object, but I want to make it so you can rotate the object by yourself. Something like this:

How would I do something like that?
Any help?

3 Likes

Create a function which checks how much the mouse moved on the screen’s width and adds a constant multiplied by that width to the object’s Y rotation.
obj.CFrame = obj.CFrameCFrame.Angles(0,constmousedeltaX,0)

Then use a transparent and empty TextButton for the MouseButton1Down event to connect that function to RenderStepped/Heartbeat. Disconnect that function with MouseButton1Up or MouseLeave.

local con
button.MouseButton1Down:Connect(function()
    con=Heartbeat:Connect(rotfunc)
end)
do
    local discfunc=function()
        return con and con:Disconnect()
    end
    button.MouseButton1Up:Connect(discfunc)
    button.MouseLeave:Connect(discfunc)
end
2 Likes