Giter Club home page Giter Club logo

Comments (11)

hexus avatar hexus commented on May 17, 2024

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.

from phaser-arcade-slopes.

iCodeForBananas avatar iCodeForBananas commented on May 17, 2024

Do you think if I lowered the gravity to slow the player down it would fix this?
Maybe if the player overlaps push them back up a couple pixels?

from phaser-arcade-slopes.

hexus avatar hexus commented on May 17, 2024

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

from phaser-arcade-slopes.

iCodeForBananas avatar iCodeForBananas commented on May 17, 2024

@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.

from phaser-arcade-slopes.

iCodeForBananas avatar iCodeForBananas commented on May 17, 2024

@hexus You wouldn't happen to have an example of Swept volumes are a way of using discrete detection that you mentioned in the attached stackoverflow answer?

from phaser-arcade-slopes.

hexus avatar hexus commented on May 17, 2024

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.

from phaser-arcade-slopes.

iCodeForBananas avatar iCodeForBananas commented on May 17, 2024

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.

from phaser-arcade-slopes.

iCodeForBananas avatar iCodeForBananas commented on May 17, 2024

Would I be able to write this in the processCallback?
http://phaser.io/examples/v2/arcade-physics/process-callback

from phaser-arcade-slopes.

iCodeForBananas avatar iCodeForBananas commented on May 17, 2024

This wouldn't be what's need to fix this would it?
http://phaser.io/examples/v2/arcade-physics/quadtree-collision-infos

from phaser-arcade-slopes.

hexus avatar hexus commented on May 17, 2024

I don't have an example to hand yet.

processCallback would run for each collision. Quadtrees are just a spatial partitioning technique used to narrow down candidates for collision detection.

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.

from phaser-arcade-slopes.

hexus avatar hexus commented on May 17, 2024

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.

from phaser-arcade-slopes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.