Programming 2D Games

The official forum for "Programming 2D Games" the book by: Charles Kelly

It is currently Sat Dec 16, 2017 3:20 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Oct 06, 2015 6:42 pm 
Offline

Joined: Tue Oct 06, 2015 6:19 pm
Posts: 1
Location: Kyiv, Ukraine
Hi! :) I have downloaded latest release of your game engine(v4.0) and now try to understand new collision detection logic. But in two functions(collideCircle and collideCornerCircle) I don't understand formula for overlapping distance:
Code:
float overlap = sqrt(sumRadiiSquared - (distSquared.x + distSquared.y));

If I correctly understood what collision vector is, shouldn't it be:
Code:
float overlap = sqrt(sumRadiiSquared) - sqrt(distSquared.x + distSquared.y);

?


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 07, 2015 8:49 pm 
Offline
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 543
You may be right. I'll try to take a look at the code this weekend.

_________________
Professor Kelly


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group