I’m trying to create a smooth-er teleport for my Model; as you can see - When leaving the model on an angle, due to the Camera being faced “Straight” on the inside compared to the outside, the Player walks in a different position as opposed to straight-forward of where they exited.
Using camera manipulation how can this be achieved?
Any ideas?
You could probably calculate an orientation difference by using CFrame:ToOrientation(), then multiply the camera’s CFrame by that difference to get an angle change result.
Here’s a rough example I quickly whipped up.
-- This is on teleport
local CurrentCamera = workspace.CurrentCamera
local CameraOrientation = Vector3.new(CurrentCamera.CFrame:ToOrientation())
local NewOrientation = Vector3.new(Orientation.CFrame:ToOrientation()) -- Orientation is assumptively a part
local Diff = (CameraOrientation - NewOrientation) * math.pi / 180 -- Convert back to radians (may have reversed the formula)
CurrentCamera.CFrame *= CFrame.Angles(Diff.X, Diff.Y, Diff.Z)
Basically - The exterior can move separately to the interior. Because of this, when teleporting between the two (as the Player’s HumanoidRootPart will mimic the CFrame of wherever it’s teleporting to) - It creates inaccurate transitions.
As shown, if the Exterior is a different Orientation to the Interior, upon exiting - The camera angles don’t match and in thus result in the Player walking in the wrong direction as opposed to forward.