https://www.roblox.com/games/5697084868/Help
^ Upon entering the test place, you can enter the door with a button to see a black room, with the furthest wall having a viewportFrame.
When the player Touches this part, thay are turned 180°, With the purpose of making it seem like you are still walking toward that door, I want to know what do I have to do with the viewport and CFrame so the real door and the one in the viewport allign and there is the least ammount of noticeable difference when turning the player around.
LocalScript that moves the camera in the viewport:
print("running")
local newcam = Instance.new("Camera")
local cam = workspace.CurrentCamera
local Pivot = script.Parent.Adornee.Parent.Parent.PrimaryPart
local dist = 60
while wait() do
local offset = cam.CFrame.Position - Vector3.new(Pivot.Position.X , cam.CFrame.Position.Y , Pivot.Position.Z)
if offset.Magnitude > dist then
wait(1)
continue
end
local Opposite = cam.CFrame --CFrame.lookAt(Vector3.new(-offset.X , cam.CFrame.Position.Y , -offset.Z) , cam.CFrame.Position)
newcam.CFrame = Opposite
script.Parent.ViewportFrame.CurrentCamera = newcam
end
BackroomViewportTest.rbxl (74.8 KB)
^RBXL file just in case