GithubHelp home page GithubHelp logo

Comments (5)

jay-jlm avatar jay-jlm commented on June 15, 2024 1

Hi, thanks for the quick response Mike, love your tutorials!
I went to the link you provided and tested with the example that is listed in the very end of the article and I still get the same results.
See a video capture here: http://nimb.ws/ikRH2w

from phaser-3-tilemap-blog-posts.

mikewesthad avatar mikewesthad commented on June 15, 2024

Hiya - are you following along with the blog post? This snippet in question is pulled from partway through the article where the tile bodies have yet to be mapped, which is described here. The article then describes how to map tile bodies to get collisions that match the tile shapes.

from phaser-3-tilemap-blog-posts.

jay-jlm avatar jay-jlm commented on June 15, 2024

Did a bit more investigation. I can reproduce this problem in other demos such as this one:
labs.phaser.io/edit.html?src=src\game%20objects\tilemap\collision\matter%20platformer%20with%20wall%20jumping.js

This is the code that I used some circles at runtime (visually is still a square block thou):

    this.input.on("pointerdown", () => {
      const worldPoint = this.input.activePointer.positionToCamera(this.cameras.main)
        const x = worldPoint.x 
        const y = worldPoint.y 
        const newImg = this.matter.add.image(x, y, "box")
        newImg.setCircle(newImg.width / 2, { restitution: 0.9, friction: 0})
        .setScale(0.5)
      
    })

Playing with the restitution values does affect the intensity of the problem. restitution=1 is the worst but once I get down to 0.6 it looks pretty much fixed.

Updated:
After further investigation I'm almost convinced it's a limitation of Matter.js's own circle collision algo.
As you can see at the link below, at resolution 0.6 the collision artifacts are barely noticeable, by 0.8 I can get stack of balls to jitter for a few seconds before the it stabilizes and by the time I get to 0.95 the stack is unstable for as long as I was able to wait.
https://codesandbox.io/s/n0jjx07nwl (mouse down to add more balls, test with at least 75% full)

from phaser-3-tilemap-blog-posts.

mikewesthad avatar mikewesthad commented on June 15, 2024

Ah, I thought that when you said:

"sometimes they stay glued to other circles without proper support and without falling over"

you were referring to the fact that they hung in the air over some of the tiles (e.g. lava and sloped tiles) since that demo doesn't have tile bodies yet. Thanks for clarifying.

The root of the issue is probably with the restitution resolution itself, since the same issue would occur if you use bouncy rectangular bodies. Have you tried adjusting the quality of the simulation via the engine props like positionIterations, or increasing the slop on the bodies?

from phaser-3-tilemap-blog-posts.

mikewesthad avatar mikewesthad commented on June 15, 2024

I'm going to close this issue. This is a matter-specific problem that might be mitigated by diving into matter configuration that's beyond the scope of what I want to cover in this tutorial series. Thanks for bringing it to my attention.

from phaser-3-tilemap-blog-posts.

Related Issues (2)

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.