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

Improve tunnelling #36

Closed
1 of 2 tasks
hexus opened this issue Apr 1, 2017 · 12 comments
Closed
1 of 2 tasks

Improve tunnelling #36

hexus opened this issue Apr 1, 2017 · 12 comments
Assignees
Labels

Comments

@hexus
Copy link
Owner

hexus commented Apr 1, 2017

As per phaserjs/phaser-ce#94 and the road map, improvements can be made to tunnelling issues that can occur with small sprites.

In the linked issue, it looks like the projectiles are only colliding with the tile face and not the entire tile.

The linked issue is caused by heuristics preventing collisions, and because the square tile has no "preferred axis" to separate on, no separation seems to occur. This is rather wrong! Pre v0.3.0, this could be solved by improving heuristics or simply not using them for square tiles.

In the case of the half tiles in the GIF below, the separation is responding correctly but without invoking collision callback, which is wrong.


There are two issues here that will be addressed by planned features in the v0.3.0 roadmap:

  • Custom SAT implementation that can ignore some axes
  • Raycasting to avoid tunnelling

For 0.2.0 we want to at least make sure that the collisions and their callbacks are responding correctly; even if no separation occurs, it's still a collision the user could need to know about.

Deciding the response vector in these situations is tricky.

@hexus hexus added the bug label Apr 1, 2017
@hexus hexus added this to the 0.3.0 milestone Apr 1, 2017
@hexus hexus self-assigned this Apr 1, 2017
@hexus hexus modified the milestones: 0.2.0, 0.3.0 Apr 1, 2017
@grayleonard
Copy link

Ran into this additional effect of the bug:

out

With square tiles, the sprite goes straight through, but with sloped tiles this happens.

@hexus
Copy link
Owner Author

hexus commented Apr 3, 2017

Thanks, this is probably to do with the heuristics that try to avoid objects catching on the corners of sloped tiles that are placed next to each other.

I'll try flinging some tiny projectiles at such tiles myself to see if I can reproduce the problem.

Out of interest, are you using collide or overlap to check for these collisions? Or are you checking the overlap properties set on the body?

@grayleonard
Copy link

Using the Arcade collide function, not doing any manual checking. Is it possible to disable that heuristic as a temp workaround?

@hexus
Copy link
Owner Author

hexus commented Apr 3, 2017

It should be yes, I'll check for you.

@hexus
Copy link
Owner Author

hexus commented Apr 3, 2017

game.slopes.solvers.sat.options.restrain = false;

:)

@grayleonard
Copy link

👍 seems to be working! Thanks.

@hexus
Copy link
Owner Author

hexus commented Apr 3, 2017

Awesome, no worries.

@hexus
Copy link
Owner Author

hexus commented Apr 3, 2017

When 0.2.0 is released you will be able to achieve the same thing with a shorter syntax (d530f30).

game.slopes.heuristics = false;

@hexus hexus modified the milestones: 0.3.0, 0.2.0 Apr 3, 2017
@hexus
Copy link
Owner Author

hexus commented Apr 17, 2017

@grayleonard Just to confirm, regarding this issue, were you destroying bullets in a collision callback?

I have a feeling the plugin simply isn't running the callback properly because of the heuristic restraints, and they aren't destroyed on those slope because they're no longer colliding with them; they're actually moving perfectly in parallel with them because there's no gravity.

@grayleonard
Copy link

Yes, I was destroying the bullets within the collision callback, and I have gravity set to 0.

It might be necessary for the project I'm working on to use the heuristics for other sprites, so I might do a bit of debugging on my own and let you know what I figure out.

@grayleonard
Copy link

(Feel free to close this issue for now though, as d530f30 resolves it)

@hexus
Copy link
Owner Author

hexus commented Apr 18, 2017

Cool. Right now I don't think heuristics can be enabled per-sprite but I will add a flag that allows this.

I was leaving this open because I think I can make improvements for 0.2.0, and have features planned for 0.3.0 relating to this too. I might just make new issues for these things though. :)

Thanks for your input here.

@hexus hexus closed this as completed Apr 18, 2017
@hexus hexus removed this from the 0.3.0 milestone May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants