function CameraUtils.GetAngleBetweenXZVectors(E,R)return math.atan2(R.X*E.Z-R.Z*E.X,R.X*E.X+R.Z*E.Z)end function CameraUtils.RotateVectorByAngleAndRound(E,R,S)if E.Magnitude>0 then E=E.unit local l=math.atan2(E.z,E.x)local g=round((math.atan2(E.z,E.x)+R)/S)*S return g-l end return 0 end
-- Legacy implementation renamed
function CameraUtils.GetAngleBetweenXZVectors(v1, v2)
	return math.atan2(v2.X * v1.Z - v2.Z * v1.X, v2.X * v1.X + v2.Z * v1.Z)
end

function CameraUtils.RotateVectorByAngleAndRound(camLook, rotateAngle, roundAmount)
	if camLook.Magnitude > 0 then
		camLook = camLook.unit
		local currAngle = math.atan2(camLook.z, camLook.x)
		local newAngle = round((math.atan2(camLook.z, camLook.x) + rotateAngle) / roundAmount) * roundAmount
		return newAngle - currAngle
	end
	return 0
end
