-
Notifications
You must be signed in to change notification settings - Fork 16
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
Player falling through tiles when moving quickly #8
Comments
I've had this issue and this is simply unavoidable with sprites too small that move too fast, especially with tiles that small. I frequently encounter this using the down control in the demo for the plugin (with and without the plugin enabled). Phaser disables collision checking for internal faces (tiles surrounded by other tiles). It's optimal and ensures that there isn't any weird separation in the case that a player does get wedged in. Instead they just fall through, like the video demonstrates. Arcade Slopes follows suit, only checking the surface (outer-most) tiles for collisions. The rest have collision disabled. If you're absolutely certain this a problem with the plugin, and not Phaser, feel free to share a demo and I'll look into it. I've tried to replicate the Arcade Physics collision behaviour as closely as possible so that adding the plugin to a project feels natural and unobtrusive; an addition rather than a full on change. |
Do you think if I lowered the gravity to slow the player down it would fix this? |
Slowing the gravity would definitely help the situation yeah, because that's what causes the problem. The player moves so far through the tile in one frame that the collision solvers push it out the wrong side (if they find it overlapping with a tile at all, they could be completely on the other side). If you increased the speed of the bullets they'd have the same problem; it's called tunnelling. Look up continuous collision detection. It's an attempt to counteract this problem by checking multiple steps per frame/tick between the current and projected location. http://gamedev.stackexchange.com/questions/34198/when-to-use-collision-detection-methods |
@hexus I have been doing a ton of testing trying to figure this out and I found that this also happens when framerate drops regardless of how fast you are moving. |
@hexus You wouldn't happen to have an example of |
Interesting. Does the same happen with regular arcade physics if framerate drops? If so, the plugin isn't missing anything. I'm not fully aware of how to implement swept volumes, but it sounds interesting. What I would attempt in this situation, personally, is multiple collision tests with the object position interpolated between it's previous and current position, between each frame. As soon as you collide with something you can bail out. |
Would you happen to have an example of this? I sort of understand what you're getting at but have no clue how to implement that. |
Would I be able to write this in the |
This wouldn't be what's need to fix this would it? |
I don't have an example to hand yet.
Google is giving me smarter answers than I could ever give you. I was going to suggest a naive approach using a loop but there are better ways. https://www.google.co.uk/search?q=swept+collision+detection I might even build something into the plugin that solves this, eventually, perhaps using raycasts from each vertex of a body between each frame. |
Is there a reason you re-opened this? It isn't an issue with the plugin. It should happen regardless of using this plugin or not. |
For whatever reason I fly up and gravity appears to bring me down through the ground.
It's hard to reproduce but tends to happen repeatedly when I fall very quickly.
http://www.youtube.com/watch?v=F_SRvUVgpWo
I tried adding the below code but to no avail:
The text was updated successfully, but these errors were encountered: