Hello.
Here’s my code:
local character = game:GetService("ReplicatedStorage"):WaitForChild("Characters"):WaitForChild("PlayerCharacters"):WaitForChild(game:GetService("Players").LocalPlayer.Name)
local viewportFrame = Instance.new("ViewportFrame")
viewportFrame.Size = UDim2.new(0.3, 0, 0.4, 0)
viewportFrame.Position = UDim2.new(0, 15, 0, 15)
viewportFrame.BackgroundColor3 = Color3.new(0, 0, 0)
viewportFrame.BorderColor3 = Color3.new(0.6, 0.5, 0.4)
viewportFrame.BorderSizePixel = 2
viewportFrame.BackgroundTransparency = 0.25
viewportFrame.Parent = script.Parent
local model = character:Clone()
model:SetPrimaryPartCFrame(CFrame.new(0, 0, 0))
model:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
model:WaitForChild("Humanoid").HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
model.Parent = viewportFrame
local viewportCamera = Instance.new("Camera")
viewportCamera.Parent = viewportFrame
--viewportCamera.CFrame = CFrame.new(Vector3.new(0, 2, 12), model.HumanoidRootPart.Position)
viewportCamera.CFrame = CFrame.new(Vector3.new(2, 0, 3), Vector3.new(1, 0, 0))
viewportFrame.CurrentCamera = viewportCamera
The Model displays like this:
Here’s a structure of ‘character’ thing I am cloning from Replicated:
How can I rotate the Model in ViewportFrame so it shows up from the front side?
Thanks for help.
1 Like
kalabgs
(FartFella)
#2
Character.HumanoidRootPart.CFrame = CFrame.new(Character.HumanoidRootPart.Position,Camera.CFrame.Position)
Doesn’t work very well. This is my new code:
local character = game:GetService("ReplicatedStorage"):WaitForChild("Characters"):WaitForChild("PlayerCharacters"):WaitForChild(game:GetService("Players").LocalPlayer.Name)
local viewportFrame = Instance.new("ViewportFrame")
viewportFrame.Size = UDim2.new(0.3, 0, 0.4, 0)
viewportFrame.Position = UDim2.new(0, 15, 0, 15)
viewportFrame.BackgroundColor3 = Color3.new(0, 0, 0)
viewportFrame.BorderColor3 = Color3.new(0.6, 0.5, 0.4)
viewportFrame.BorderSizePixel = 2
viewportFrame.BackgroundTransparency = 0.25
viewportFrame.Parent = script.Parent
local model = character:Clone()
model:SetPrimaryPartCFrame(CFrame.new(0, 0, 0))
model:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
model:WaitForChild("Humanoid").HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
model.Parent = viewportFrame
local viewportCamera = Instance.new("Camera")
viewportCamera.Parent = viewportFrame
--viewportCamera.CFrame = CFrame.new(Vector3.new(0, 2, 12), model.HumanoidRootPart.Position)
viewportCamera.CFrame = CFrame.new(Vector3.new(2, 0, 3), Vector3.new(1, 0, 0))
viewportCamera.CFrame = CFrame.new(character.HumanoidRootPart.Position, viewportCamera.CFrame.Position)
viewportFrame.CurrentCamera = viewportCamera
Here’s what happened:
Also note that ‘character’ is not player’s Character. It’s a Model cloned from ReplicatedStorage.
kalabgs
(FartFella)
#4
oh u used the camera then u should do
viewportCamera.CFrame = CFrame.new(viewportCamera.CFrame.Position,character.HumanoidRootPart.Position)
It does not render propertly again. The only difference is that the camera is far away from the character.
It’s doesn’t seem to be rotated in the right way either.