Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Bounding Circle collision detection: KineticJS/HTML5 Tutorial

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 gamingthinktank   Members   

125
Like
0Likes
Like

Posted 23 July 2013 - 05:31 AM

This tutorial explains the mathematics behind collision detection using bounding circle method. Source code and online demo is available with the tutorial.

 

Bounding Circle collision detection: KineticJS/HTML5 Tutorial



#2 jjd   Members   

2140
Like
1Likes
Like

Posted 23 July 2013 - 07:28 AM

This tutorial explains the mathematics behind collision detection using bounding circle method. Source code and online demo is available with the tutorial.

 

Bounding Circle collision detection: KineticJS/HTML5 Tutorial

 

Just a suggestion: get rid of the sqrt operation. It is slow and unnecessary. The same test can be expressed as,

var sum_radii = sprite1Radius + sprite2Radius;
var sum_radii_sqr = sum_radii * sum_radii;

var dist_sqr = (distanceX * distanceX) + (distanceY * distanceY);

return dist_sqr <= sum_radii_sqr

-Josh


Edited by jjd, 23 July 2013 - 07:29 AM.

--www.physicaluncertainty.com
--linkedin
--irc.freenode.net#gdnet





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.