SO, I made the following simple circle pong toy. I am having issues with getting the correct angle . I'm getting negative values for the tophalf of the circle ?! how can I just get 0 > 360 ?!
https://github.com/Sweetkubuni/circle_pong
issue with circle pong collision detection

 Prole
 Posts: 3
 Joined: Thu Sep 21, 2017 11:52 am
Re: issue with circle pong collision detection
In your function LineAngle, replace math.atan with math.atan2 and replace the division sign with a comma.
Specifically, note the differences between the parameters for math.atan and math.atan2 in the Lua 5.1 documentation. Also note that math.atan2 was deprecated in 5.3 (emphasis mine):
Specifically, note the differences between the parameters for math.atan and math.atan2 in the Lua 5.1 documentation. Also note that math.atan2 was deprecated in 5.3 (emphasis mine):
LOVE uses LuaJit, which is compatible with Lua 5.1, so it shouldn't be an issue. Just something to be aware of.Lua 5.3 Reference Manual wrote:The following functions were deprecated in the mathematical library: atan2, cosh, sinh, tanh, pow, frexp, and ldexp. You can replace math.pow(x,y) with x^y; you can replace math.atan2 with math.atan, which now accepts one or two parameters; you can replace math.ldexp(x,exp) with x * 2.0^exp. For the other operations, you can either use an external library or implement them in Lua.
GitHub  MLib  Math and shape intersections library  Walt  Animation library  Brady  Camera library with parallax scrolling  Vimlovedocs  Help files and syntax coloring for Vim

 Prole
 Posts: 3
 Joined: Thu Sep 21, 2017 11:52 am
Re: issue with circle pong collision detection
I did what you suggest. Though, I think atan2 takes the arguments as atan2(x,y) ; anyway, I tried running the folder on lovec.exe, but whenever the ball hits the circle my game crashes (well stops).davisdude wrote: ↑Fri Sep 22, 2017 1:39 pmIn your function LineAngle, replace math.atan with math.atan2 and replace the division sign with a comma.
Specifically, note the differences between the parameters for math.atan and math.atan2 in the Lua 5.1 documentation. Also note that math.atan2 was deprecated in 5.3 (emphasis mine):
LOVE uses LuaJit, which is compatible with Lua 5.1, so it shouldn't be an issue. Just something to be aware of.Lua 5.3 Reference Manual wrote:The following functions were deprecated in the mathematical library: atan2, cosh, sinh, tanh, pow, frexp, and ldexp. You can replace math.pow(x,y) with x^y; you can replace math.atan2 with math.atan, which now accepts one or two parameters; you can replace math.ldexp(x,exp) with x * 2.0^exp. For the other operations, you can either use an external library or implement them in Lua.
 zorg
 Party member
 Posts: 2124
 Joined: Thu Dec 13, 2012 2:55 pm
 Location: Absurdistan, Hungary
 Contact:
Re: issue with circle pong collision detection
atan2 takes arguments in the order of y,x; as a matter of fact; you may be expecting 0 degrees/radians to point in a direction other than it actually does, though.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

 Prole
 Posts: 3
 Joined: Thu Sep 21, 2017 11:52 am
Re: issue with circle pong collision detection
I think I found the issue for doing collision here https://stackoverflow.com/questions/630 ... 20#6312520
Who is online
Users browsing this forum: MrFariator and 5 guests