Camera shakes uncontrollably when I try to move it

I’m trying to make a system in my game to allow accurate physic simulations on moving platforms, including the player moving around on it. I’m planning on doing this by having a separate, invisible collision group with a stationary copy of the platform that the physic objects are teleported to and from when they get on and off the platform, with an anchored copy of them being updated by RunService.Heartbeat to match their positions and orientations to the physics simulator.

This is working perfectly so far, until I tried moving the camera from a player character on the platform to its clone using RunService:BindToRenderStep(), what resulted is the camera spinning out of control as seen here by my character landing on the platform:

robloxapp-20210226-1305127.wmv (1.1 MB)

I don’t really have that much experience with camera controls or player inputs, I’ve mostly just been working with physics and CFrame, so I’m a bit in the dark here on what’s going on. I have tried just changing the camera subject to the clone, but that didn’t provide an accurate update to the camera’s orientation relative to the platform, and made WASD not move you in the correct direction. Here’s the relevant code I have for this:

function RelativeCFrame(ObjectCFrame,OldCFrame,NewCFrame)
	return NewCFrame * OldCFrame:Inverse() * ObjectCFrame

function CameraStep(dt)
	Camera.CFrame = RelativeCFrame(Camera.CFrame,MovingWorld.CFrame,ClonedWorld.CFrame)

function PlayerWorldUpdateFunction()
	if LocalPlayer.Character == nil then
	if CollectionService:HasTag(LocalPlayer.Character,"MovingPhysicsChild") then
		PhysicsWorld = MovingWorld
		PhysicsClone = InstanceFromTag(LocalPlayer.Name.."PhysicsClone")
		if PhysicsClone then
			CloneHumanoid = PhysicsClone:WaitForChild("Humanoid")
			--Camera.CameraSubject = CloneHumanoid --Doesn't follow world
		RunService:BindToRenderStep("MovingPhysicsCamera",205,CameraStep) --Camera shakes

		PhysicsWorld = nil
		PhysicsClone = nil
		CloneHumanoid = nil
		if LocalPlayer.Character then
			if LocalPlayer.Character.Humanoid then
				--Camera.CameraSubject = LocalPlayer.Character.Humanoid