Giter VIP home page Giter VIP logo

Comments (11)

jacobclarke92 avatar jacobclarke92 commented on May 2, 2024 3

I experienced this issue too but on phaser's (currently 3.22.0) implementation of MatterJS.
I worked out it was because I wasn't updating world bounds upon window resize, so at a certain point the right hand bound wall would pass over my character's hitbox and either force them to move left or right depending on which side of the wall they were closer to.

Normally this might be fine / unnoticeable but because I was repositioning the character to the centre of the screen each frame and moving everything else based on that difference from the center point, it meant that my whole world perpetually whizzed by at particular screen aspect ratios.

This might help someone so figured I'd post, no need to re-open.

from matter-js.

liabru avatar liabru commented on May 2, 2024

That code should work, it's the same as I'm doing in DemoMobile.js so take a look there.

I'm not sure what you mean that they move, do you mean they are translated or do you mean they actually gain some velocity?

from matter-js.

Danetag avatar Danetag commented on May 2, 2024

It seems they actually gain velocity!

from matter-js.

liabru avatar liabru commented on May 2, 2024

Hmm that's weird. Can I see a jsfiddle?

from matter-js.

liabru avatar liabru commented on May 2, 2024

Did you manage to figure this one out?

from matter-js.

Danetag avatar Danetag commented on May 2, 2024

Hey!

Not really, had to move to an other project, this issue is still on :/ Thanks tho!

from matter-js.

liabru avatar liabru commented on May 2, 2024

I can't reproduce your issue by changing the bounds max as you said in your first post.
Can you provide an example?

from matter-js.

liabru avatar liabru commented on May 2, 2024

I think this will no longer be an issue as of #67 so closing. Please update if this is still a problem.

from matter-js.

vtheviking avatar vtheviking commented on May 2, 2024

Hey i noticed that im experiencing the same problem. Im trying to use
var h = window.height;
var w = window.width;
engine.world.bounds.max.x = w;
engine.world.bounds.max.y = h;
function resizeCanvas() {
window.addEventListener('resize', resizeCanvas, false);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

resizeCanvas();

but it doesn't seem to be resizing my canvas element. Im trying to get the canvas to adjust its height and width according to the size of the viewport or window screen and change as the screen resizes, i looked at issue #67, and i made the post at #118. Im not seeing any results yet, and if you can point me in the right direction for objects sticking to the "ground" or set boundaries like at the website www.berberianmysterytheatre.com you could see the objects settling or sticking to a boundary after about 20seconds or so.

Thanks again btw.

from matter-js.

liabru avatar liabru commented on May 2, 2024

Are you using the latest master build? If not then switching to it will resolve this.

from matter-js.

vtheviking avatar vtheviking commented on May 2, 2024

I don't think so, ill implement the new build and see how it turns out, and update the issue.
thanks though!!

from matter-js.

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.