I'm having some issue regarding collision detection in a game i am making. I have the distance between the two objects using this:
double b1Dist = Math.sqrt((obOneX - obTwoX) * (obOneX - obTwoX)
+ ((obOneY - obTwoY) * (obOneY - obTwoY)));
double b1DistTwo = b1Dist - objectOneRadius;
b1DistFinal = b1DistTwo - objectTwoRadius;
and I was attempting to do collision detection with this:
if (b1DistFinal <= objectOneRadius && b1DistFinal <= objectTwoRadius ) {
return false;
}
else
return true;
}
I'm new to java so i'm sure theres probably much better/more efficient ways to write the above, however could anyone please help me out or point me in the right direction?
Thanks