function core.findAngle(C,e,s)local B=s.Orientation.Y local l=math.atan2(e.Z-C.Z,e.X-C.X)local A=(math.deg(l)+B)+90 if A>180 then A=-(360-A)elseif A<-180 then A=360+A end return A end function core.findPitch(C,e,s)local B=s.Orientation.X local l=math.atan2(e.Y-C.Y,math.abs(e.Z-C.Z))local A=math.deg(l)+B if A>180 then A=-(360-A)elseif A<-180 then A=360+A end return A end function core.tempAttach(C,e)local s=Instance.new("\065\116\116\097\099\104\109\101\110\116")s.WorldPosition=C s.Parent=workspace.Terrain debrisService:AddItem(s,e)return s end function core.playSound(C,e)local s=core.tempAttach(e,C.TimeLength)local B=C:Clone()B.Parent=s B:Play()end return core
--Calculates an angle in relation to another part.
function core.findAngle(pos1, pos2, part)
	local yOrientation = part.Orientation.Y
	local rot = math.atan2(pos2.Z - pos1.Z, pos2.X - pos1.X)

	local desiredAngle = math.deg(rot) + yOrientation + 90
	if desiredAngle > 180 then
		desiredAngle = -(360 - desiredAngle)
	elseif desiredAngle < -180 then
		desiredAngle = 360 + desiredAngle
	end

	return desiredAngle
end

function core.findPitch(pos1, pos2, part)
	local xOrientation = part.Orientation.X
	local rot = math.atan2(pos2.Y - pos1.Y, math.abs(pos2.Z - pos1.Z))

	local desiredAngle = math.deg(rot) + xOrientation
	if desiredAngle > 180 then
		desiredAngle = -(360 - desiredAngle)
	elseif desiredAngle < -180 then
		desiredAngle = 360 + desiredAngle
	end

	return desiredAngle
end

function core.tempAttach(pos, life)
	local attach = Instance.new("Attachment")
	attach.WorldPosition = pos
	attach.Parent = workspace.Terrain

	debrisService:AddItem(attach, life)

	return attach
end

function core.playSound(sound, pos)
	local attach = core.tempAttach(pos, sound.TimeLength)
	local soundClone = sound:Clone()
	soundClone.Parent = attach
	soundClone:Play()
end

return core
