bump icon indicating copy to clipboard operation
bump copied to clipboard

error in findCollisionType

Open Grajon opened this issue 7 years ago • 0 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); [...]

Grajon avatar Oct 01 '18 12:10 Grajon