I am making an elevator system that teleports you from one elevator to the other, however when the player teleports, the camera doesn’t rotate with the player.
I have this code code to handle camera update:
--StartCf is the starting elevator CFrame
--EndCf is the elevator cframe you tp to
local function updateCamera(StartCf,EndCF)
char = char or getChar(player)
local head = char:WaitForChild("Head")
local camCf = camera.CFrame
--Camera stuff
end
However i can’t figure out the math to make it work.
They need to have the same rotation and lighting, and the player needs to teleport to the exact location that they were in the previous elevator. You can calculate the relative CFrame of the camera as well, but it might not work very well.
Probably use elevatorfloorCFrame:toObjectSpace(cameraCFrame) to get the relative cframe, then multiply the new elevator floor cframe by that value to get the new camera cframe.