-
What do you want to achieve?
I want the viewport camera to adjust its position when a character (or model) gets inserted. Ex: When a character gets inserted, the camera changes its position to make sure the character is in frame to avoid clipping issues. -
What is the issue?
I do not know how to achieve that… Here is part of the code and a reference screenshot (Part Instance is just for reference)
Code:
local function createChar(anomaly)
if playercharClone then
playercharClone:Destroy()
end
if anomaly then
playercharClone = anomaly:Clone()
playercharClone.Parent = viewportFrame.WorldModel
playercharClone:SetPrimaryPartCFrame(CFrame.new(0, 5, 0) * CFrame.Angles(0, 45, 0))
else
char.Archivable = true
playercharClone = char:Clone()
char.Archivable = false
playercharClone.Parent = viewportFrame.WorldModel
playercharClone:SetPrimaryPartCFrame(CFrame.new(0, 5, 0) * CFrame.Angles(0, 45, 0))
end
end
-
What solutions have you tried so far?
I’ve tried scripting it, but I’ve gone to problems. Maybe someone can help me here.