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

Collision fixes #2422

Merged
merged 16 commits into from
Apr 22, 2022
Merged

Collision fixes #2422

merged 16 commits into from
Apr 22, 2022

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented Oct 2, 2021

For chosencharacters/squidBounties#6

Here are videos showing the changes.
https://imgur.com/a/9yXzCwk

summary:

  • preserve momentum in collisions, fixing several bugs with mass. (Used this article as a guide and this to test)
  • add a new collisionXDrag that takes an enum, to allow objects to stick to non-immovable objects.
  • deprecate collisonXDrag (missing an "i" in collision)

breaking changes:

  • the new collision will break old replays, so I added the FLX_4_LEGACY_COLLISION compiler flag

I'm still checking all the demos, but I'm pretty confident they will all work

@Geokureli
Copy link
Member Author

Yeah all the demos are behaving nicely, and none of the snippets should be affected

@Geokureli
Copy link
Member Author

Just noting: I tried modifying how separate() moves the colliding objects. I tried displacing inversely proportional to their mass, like so:

Object1.x -= overlap * mass2 / (mass1 + mass2);
Object2.x += overlap * mass1 / (mass1 + mass2);

this caused a lot of problems with stacking heavy objects on light objects, and pushing objects into other objects, so I decided against it.

@Beeblerox Beeblerox mentioned this pull request Oct 7, 2021
1 task
@Geokureli Geokureli changed the title SquidBounties - Collision stuff Collision fixes Apr 20, 2022
@Geokureli Geokureli added this to the 5.0.0 milestone Apr 20, 2022
@Geokureli Geokureli mentioned this pull request Apr 20, 2022
10 tasks
@Geokureli Geokureli merged commit 88eb281 into HaxeFlixel:dev Apr 22, 2022
@Geokureli Geokureli deleted the collision branch May 10, 2022 20: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.

1 participant