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

Fix freeze when actor width or height is 0 and tilemap is shown #1491

Conversation

DaVince
Copy link
Contributor

@DaVince DaVince commented Apr 14, 2020

Closes #1418

TileMapImpl.collides() got stuck infinitely on the trace points for overlap loop when the actor's size is zero.

Changes:

  • Check size of actor before deciding whether to run the collision logic
  • Return null when actor width or height is 0

@DaVince
Copy link
Contributor Author

DaVince commented Apr 14, 2020

This is my second merge request on an open source project ever, please let me know if I did it right! 🙂

@DaVince
Copy link
Contributor Author

DaVince commented Apr 14, 2020

In the failing test, an object with a non-zero size is being tested, but it fails anyway. My implementation might have been naive. Will look into this further.

@DaVince
Copy link
Contributor Author

DaVince commented Apr 14, 2020

Test Collision Shape a Circle should collide with other polygons when touching fails, but I have no clue why, because on further inspection it does nothing with TileMaps. Is it even related? Additionally, it seems to have succeeded on subsequent unrelated commits?

Testing the code tells me collisions work; they don't seem to have broken. Except for zero-size actors, which now are not checked at all. Is this behavior acceptable?

On another note: can actor widths and heights ever be a negative value?

@eonarheim
Copy link
Member

eonarheim commented Apr 14, 2020 via email

@eonarheim
Copy link
Member

@kamranayub ^ Any more info on this test

@eonarheim
Copy link
Member

eonarheim commented Apr 14, 2020

@DaVince This looks great, is it possible to add a test for this fix? (ignore the flakey test)

@eonarheim
Copy link
Member

If it is too onerous to add a test for this let me know.

@kamranayub
Copy link
Member

I wouldn't worry about that test, it has failed in master before and will pass on a rebuild. Definitely flaky.

@DaVince
Copy link
Contributor Author

DaVince commented Apr 15, 2020

Thanks for all the great feedback!

@DaVince This looks great, is it possible to add a test for this fix? (ignore the flakey test)

Sure, I'm on it.

Copy link
Member

@eonarheim eonarheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaVince Thanks again for the contribution!

@eonarheim eonarheim merged commit 8bdbabd into excaliburjs:master Apr 15, 2020
@DaVince DaVince deleted the bugfix/1418-crash-when-using-tilemaps-and-actors branch April 15, 2020 12:28
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

Successfully merging this pull request may close these issues.

Excalibur crashes when using tilemaps and actors together
3 participants