Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in findCollisionType #19

Open
Grajon opened this issue Oct 1, 2018 · 0 comments
Open

error in findCollisionType #19

Grajon opened this issue Oct 1, 2018 · 0 comments

Comments

@Grajon
Copy link

Grajon commented Oct 1, 2018

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);
[...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant