How to achieve seamless teleporting between elevators?

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.

2 Likes

Make a gui fade into black then do the teleportation. Maybe that will give you a desired effect.

1 Like

It could work but i want a seamless transition without gui fading.

1 Like

Its my only idea. I dont really get into CFrame stuff about the camera, so if you dont find a good solution, i recommend mines.

1 Like

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.

So I’m guessing the elevators have orientations that are different by increments of 90 degrees?

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.

Ok, i’ll try that solution out.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.