Comments (11)
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.
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.
It seems they actually gain velocity!
from matter-js.
Hmm that's weird. Can I see a jsfiddle?
from matter-js.
Did you manage to figure this one out?
from matter-js.
Hey!
Not really, had to move to an other project, this issue is still on :/ Thanks tho!
from matter-js.
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.
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.
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.
Are you using the latest master build? If not then switching to it will resolve this.
from matter-js.
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)
- Chain connecting 2 players causes 1 player to accelerate slower than the other even with same force
- Render.setSize is not present in the build
- Trying to change seed, to take control of deterministic behavior
- How to suppress body tremors? HOT 2
- Why does the attractor only work on one of the two BODYs? HOT 1
- Using compound bodies with Bodies.fromVertices does not work it just shows a filled in shape. HOT 1
- Why don't bodies sometimes collide? HOT 1
- Constraints with distance limits (e.g. for ropes)
- Why might there be such an error? HOT 1
- Simple Polygon Physics Issues HOT 1
- How to add project to the Wiki gallery ?
- How to scale the world? HOT 2
- [Phaser 3] Position of matter sprite's image not correct in container HOT 1
- loss of sprite quality on mobile HOT 1
- `Composite.translate` didn't move the bodies included
- Create Matter.Bodies.fromVertices with rounded vertices
- MouseConstraint preventing clicks on buttons on mobile. HOT 2
- Vulnerability related to the formula of universal gravitation
- Body with high mass and low inertia behaves erratically
- The startdrag event of dragging a body does not trigger after losing focus.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matter-js.