How do people make 3D models rotating in UI?

Hey!
I recently found about VideoFrame and was wondering how do you make 3D models with animations in a GUI? A example would be a shop showing a item, and it rotates to show you the entire model, how is this done?

2 Likes

I’m pretty sure for this, you need a ViewportFrame | Roblox Creator Documentation.

You can search up a few tutorials on ViewportFrames and I think you’ll get it.

1 Like

Related to the rotation, I just wanted to add that it’s much less expensive and reliable to rotate the ViewportFrame camera instead of the actual object.

2 Likes

How would this be done? (Char)

Like this? https://gyazo.com/0e3b090be5d0e9171b5c7613f9f152ae

1 Like

Yes (CharacterLimitMoment()()())

I modified a script on the Developer Hub to achieve this.

local TweenService = game:GetService("TweenService")

local viewportFrame = script.Parent

local part = Instance.new("Part")
part.Material = Enum.Material.Concrete
part.Color = Color3.new(0.25, 0.75, 1)
part.Position = Vector3.new(0, 0, 0)
part.Parent = viewportFrame


local viewportCamera = Instance.new("Camera")
viewportFrame.CurrentCamera = viewportCamera

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)

local tween = TweenService:Create(part, tweenInfo, {Orientation = Vector3.new(0,360,0)})

while true do
	tween:Play()
	tween.Completed:Wait()
end

image
Put the script inside the viewportFrame.

1 Like

Doesn’t work for models, though.

local TweenService = game:GetService("TweenService")

local viewportFrame = script.Parent

local part = workspace.MartiniHenry.PrimaryPart


local viewportCamera = Instance.new("Camera")
viewportFrame.CurrentCamera = viewportCamera

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)

local tween = TweenService:Create(part, tweenInfo, {Orientation = Vector3.new(0,360,0)})

while true do
	tween:Play()
	tween.Completed:Wait()
end

Weld everything to the primary part then.

I did, all it does is spin the part in the workspace model, doesn’t even appear in the frame.

Try to see if you welded it correctly, unanchor the item to see if all parts are welded to the PrimaryPart.

All are like that. (character)

“All are like that”
What do you exactly mean by this?
Can you show me a screenshot of what happens when you unanchor everything?
I do not want to see the GUI, I want to see the model when you unanchor everything.

Everything you said is already there. Changing it would just be cloning it.

It may be just because it is late at night, but I do not understand a single word you are saying.
Send me a screenshot of what happens when you unanchor the model. I want to see if anything isn’t sticking to the primary part.

I’m not currently on the game but I can explain it, The main part rotates and not the entire model. It also doesn’t even appear in the frame.
If your tired, you can go. I’ll probably find it by messing around one day.

I have an issue using this script.
image
as shown in the image, the script works but the object is really small in the gui. How do I fix this? maybe like making the object bigger?

Bring the part closer to the viewport.