problem with equation Pythagorean in OF

Hello! I’m using the Pythagorean equation but doesn’t work, the sintaxis is correct but tuhe program doesn’t work correctly. I have twoo separate balls and with a radio that increase and decreases all the time. When the balls are in contact the program shoud play a sound.

This is the equation:

if (sqrt((Ball02.rathX - Ball01.rathX)^2 + (Ball02.rahtY - Ball01.rathY)^2) >= (Ball01.radi + Ball02.radi)){;

thank you very much!

What behavior does your code currently exhibit? It looks like the code you posted is playing the music only when Ball01 & Ball02 are far apart (farther than the sum of their radii).

You might try something like

float dist = ofDist(Ball01.rathX,Ball01.rathY,Ball02.rathX,Ball02.rathY);  
float contactDistance = Ball01.radi + Ball02.radi;  
if(dist < contactDistance)  

If you want the music to stop when they touch, switch the inequality operator.

Thank you man!!! it works!