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

Arcade Physics allow sprites to push eachother through otherwise impassable objects #1513

Closed
amishshah opened this issue Jan 4, 2015 · 5 comments

Comments

@amishshah
Copy link

Hi!
I'm using Arcade Physics, and whenever 2 of my sprites collide, one pushes the other down into the ground until it falls off. I don't want to use P2 Physics just to fix this bug!

part1
part2
part3
part4
part5

@amishshah amishshah changed the title Arcade Physics allow sprites to "compress eachother" Arcade Physics allow sprites to push eachother through otherwise impassable objects Jan 4, 2015
@pnstickne
Copy link
Contributor

Nice image story - it makes the problem clear.

Unfortunately, I don't think is trivially resolvable with the current Arcade physics ..

The collisions of the entire system need to be considered to prevent moved objects (that are not themselves marked as immovable) from pushing through other objects (immovable or not).

P2 is an implementation that can understand the system-wide constraints - is there a particular aspect of P2 that is undesirable in this case? (It might be able to work around such if there is.)

In general I would only use Arcade in a system where a particular initiator always reacts (eg. target is immovable), there is a custom handler, or touch = event & pass-through or pick-up; there are many games that fit in this category, but not everything.

@amishshah
Copy link
Author

My problem with using P2 is that I lose a lot of the nice stuff I get with arcade. For example, it seems like an absolute pain to implement "body.touching.down" with P2.

@pnstickne
Copy link
Contributor

@hydrabolt I wonder if it may simply be simplest for the current case to make the "brick" immovable so that the Arcade physics will not move it in a collision.

Any interaction (eg. pushing) with the brick would then have to be controlled manually, of course. It should be able to use the left/right touching in that case.

@amishshah
Copy link
Author

Thanks, but I face 2 problems with this:

  1. The brick seems to fall through the ground when it's body is set to immovable
  2. I want it to be affected by hits from missiles, explosions etc.

@photonstorm
Copy link
Collaborator

What I'd suggest is using a custom separation handler for the brick. Then you can re-position the character sprite accordingly and prevent the brick from tunnelling through the floor. The principal would be identical to the tutorial I wrote for cloud platforms in Phaser Coding Tips 4

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

3 participants