local function y(y,C,e)local E,c=y:Dot(C),y:Cross(C)if E<-0.99999 then return CFrame.fromAxisAngle(e,math.pi)end return CFrame.new(0,0,0,c.x,c.y,c.z,1+E)end local function C(y,C)local e,E=y:ToAxisAngle()local c,s=math.cos(E/2),math.sin(E/2)*e local O=s:Dot(C)*C local o=CFrame.new(0,0,0,O.x,O.y,O.z,c)local t,N=o:ToAxisAngle()return math.sign(s:Dot(C))*N end
-- Functions

local function getRotationBetween(u, v, axis)
	local dot, uxv = u:Dot(v), u:Cross(v)
	if dot < -0.99999 then
		return CFrame.fromAxisAngle(axis, math.pi)
	end
	return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot)
end

local function twistAngle(cf, direction)
	local axis, theta = cf:ToAxisAngle()
	local w, v = math.cos(theta / 2), math.sin(theta / 2) * axis
	local proj = v:Dot(direction) * direction
	local twist = CFrame.new(0, 0, 0, proj.x, proj.y, proj.z, w)
	local nAxis, nTheta = twist:ToAxisAngle()
	return math.sign(v:Dot(direction)) * nTheta
end
