I have created a cannon with a look function that uses some math to align welds to point at the target.
local y = math.atan2(rot.LookVector.Z, rot.LookVector.X)
local z = -math.atan2(rot.LookVector.Y, rot.LookVector.Z + math.pi / 2)
warn(z)
-- local angleInRadians = math.acos(primaryPart.CFrame.LookVector:Dot((primaryPart.Position - point.Position).Unit))
verticalPivot.C0 = CFrame.Angles(0, 0, z)
groundWeld.C0 = CFrame.new(groundWeld.C0.Position) * CFrame.Angles(0, y + math.pi, 0)
the cannon uses fastcast for the projectiles and how do I calculate bullet lead so it actually hits the target?