Is this possible? (Viewports)

Before I begin spending a lot of time trying doing this, I was wondering if it is possible to make a viewport have a dynamic background. I want to have a centerpiece that is rotated around, and I want that centerpiece to be in a room with decorations. Is this possible to do if I just make the entire room a model and set the primary part to the item and basically try to set the camera inside of the model? Or is there a better way to do this? I’m new to viewports so I’m pretty unfamiliar with what should and shouldn’t be done with them.

I don’t see anything here that would make that impossible.

2 Likes

you mean something like this? @Xyphur

https://gyazo.com/336a18f21009edbc0d06c34e1f7436d0

its very possible, you can even render the whole room into the viewport frame. (and then make the camera rotate around the center piece)

1). add camera to viewport frame
2). add room model & an ‘invisible’ center piece to viewport frame
3). add your actual center piece to the viewport frame. (unless its part of of the room model)
4). use RenderStepped to handle rotation

I do something like this for easier orbital movements.

local zoom = -5
game:GetService("RunService").RenderStepped:Connect(function()
    --if ScreenGui is enabled
    if(script.Parent.Enabled==true) then
        --rotate the invisible center peice
	centerPart.CFrame = centerPart.CFrame * CFrame.Angles(0,math.rad(0.5),0)
        --make camera match the invisible peices' CFrame (plus lookVector multiplied by zoom)
	camera.CFrame = centerPart.CFrame + centerPart.CFrame.lookVector*zoom
    end
end)

instead of using sin/cos math to orbit, you can simply rotate an invisible ‘center peice’ and then have the camera match its CFrame. (plus the center pieces lookVector multiplied by zoom)

Click to see the power of viewport frames

https://www.roblox.com/library/4738289238/PortalMaker-V2
https://www.youtube.com/watch?v=VSyNwVqg-Rs
https://www.youtube.com/watch?v=TlXO2BJ-5zE

3 Likes

This is exactly what I needed, thank you! That portal thing looks really interesting.

no problem and yeah the portal plugin is pretty cool, I still need to update it a bit though, but if you need anymore assistance just ping me or DM me.

1 Like