kittykatattack / bump

A set of 2D collision utilities for games.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error in findCollisionType

Grajon opened this issue · comments

Hi everyone,

I think i have found a problem in findCollisionType function.
In findCollisionType to determine if an object is a circle, the existence of diameter member is tested :

[...]
if (a.diameter && b.diameter) {
//They're circles
return circleVsCircle(a, b);
} else if (a.diameter && !b.diameter) {
//The first one is a circle and the second is a rectangle
return circleVsRectangle(a, b);
[...]

But diameter is never added in addCollisionProperties, while the radius is it, so I suggest to use radius instead of diameter, and the code of findCollisionType become :

[...]
if (a.radius && b.radius) {
//They're circles
return circleVsCircle(a, b);
} else if (a.radius && !b.radius) {
//The first one is a circle and the second is a rectangle
return circleVsRectangle(a, b);
[...]