Hello I have a problem with the angle, actually I know what's the problem but I can't fix it.
I'm trying to set the right angle from the position of where it shoot and the position of my mouse, but sometime the bullet get the bad angle.
My problem is right on this little gif.
*IMPORTANT: * the variable dy is the distance of the axe of y and the variable distance is the hypotenuse from where I click
there's a part of my code where I get the problem:
function bullet:SetRotation(defAngle)
local angle = defAngle or math.deg(math.asin(self.data.dy / self.data.distance))
self.instance.Rotation = angle --instance is the bullet(frame)
end

1 comment
thanks