+ 2
Hello guys, plz suggest me a technique to find collisions between circles
I want to add inter circle collisions in my code https://code.sololearn.com/WoOo26XYznFf/?ref=app
4 Respuestas
+ 3
xfirstcircle - xsecondcircle >= 0 and
xfirstcircle - xsecondcircle <= r*2 and
yfirstcircle - ysecondcircle <= r*2 and
yfirstcircle - ysecondcircle >= 0 and
x is the x position of the circle
y is the y position of the circle
r*2 = diameter of the circle
+ 3
xfirstcircle - xsecondcircle >= -r and
xfirstcircle - xsecondcircle <= r and
yfirstcircle - ysecondcircle <= r and
yfirstcircle - ysecondcircle >= -r and
Maybe this one
+ 2
Vitanonimato thanks for answering bro,
I realised circle collision is easier than rect collision.
we just have to check if distance between center of both circle are less than sum of their radius.
https://code.sololearn.com/Wx2bObC3nXNw/?ref=app
0
Vitanonimato Thanks, I have tried it before.
It is only giving rectsngle collision.