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

Update getIntersection() to handle multiple intersections #281

Merged

Conversation

CalvinMT
Copy link
Contributor

@CalvinMT CalvinMT commented Jul 1, 2019

  • "getIntersection()" now returns a Rectangle2D representing the union of intersections between the targeted position and all collision boxes that the entity would be colliding with at that targeted position.
  • Add tests in CollisionResolvingTests.java for multiple intersections when moving.

- "getIntersection()" now returns a Rectangle2D representing the union of intersections between the targeted position and all collision boxes that the entity would be colliding with at that targeted position.
- Add tests in CollisionResolvingTests.java for multiple intersections when moving.
@steffen-wilke steffen-wilke self-requested a review July 1, 2019 19:19
Copy link
Contributor

@steffen-wilke steffen-wilke left a comment

Choose a reason for hiding this comment

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

Nicely done! I tested the updated physics with a few game examples and everything works fine. I think this also prevents some weird physics glitches that were related to velocity and collision boxes that were placed closely together.

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.

None yet

2 participants