Aug 18, 2020, 12:52 PM

X1&Y1 are the center coordinates of object 1
X2 & Y2 are the center coordinates of object 2

The output of the javascript "Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2))" is the distance between these two points.

the radius is not in this formala. 

for example if you have 2 objects with a radius of 2. than if the distance is 4 you know they collide.

if you work with squares you can do the same but you have to do the X and Y distance separately.