question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Small tunneling with Body.setVelocity

See original GitHub issue

Hi !

I’m trying to do a platformer game with matter.js.

And I got trouble when pressing right key, that set Body.setVelocity X to -10 and jumping that set Body.setVelocity Y to -10. The problem is that the body enter slightly in the body next to him even with : inertia : Infinity, frictionStatic : 0, friction : 0, slop : 0, So because of this, the body collide with a body above him, and it should not. It’ supposed to “glide” on the other body.

Img : sans titre

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
landgreencommented, Mar 13, 2017

I experienced this as well. I shaped the player’s body to have angles at the bottom to avoid the problem.

https://landgreen.github.io/sidescroller/ Press T to enter testing to see the player shape.

0reactions
eirikbcommented, Jun 22, 2018

@hilde2 Did you find a good solution? Here is my current approach: https://jsfiddle.net/a7wjrh4u/2 . Movement: <kbd>w</kbd><kbd>a</kbd><kbd>d</kbd>

The { chamfer: 8 } (thanks @liabru) helps a bit, but not completely. Another trick would be to simply not stack static bodies, and instead have a big one, like this: https://jsfiddle.net/a7wjrh4u/8 .
I’m not sure if movement is correctly done, the jumping feels a bit strange.

@hilde2 for your first pictures you could try putting the static bodies into each other, like this: https://jsfiddle.net/a7wjrh4u/9/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Matter.Body Module - Matter.js Physics Engine API Docs - brm.io
setVelocity. (body, velocity). Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also Body.applyForce .
Read more >
Fast moving bodies and tunneling - Real-Time Physics ...
The is a lot of problems, actually; the biggest is well-known fast body tunneling. Relatively small objects that form the ragdoll suffer
Read more >
moving mesh zone, set velocity to all cells of rotation zone.
I want to simulate rotational propeller. I created the rotation zone and static zone. then setup mesh motion for rotation zone. and also...
Read more >
Physics2D Module | Package Manager UI website
Tiny supports a subset of Unity 2D Physics referred to as the Physics2D module. ... A Static body does not move under simulation...
Read more >
Energy expenditure during flight in relation to body mass: effects of ...
Little direct information on the effect of body mass on flight costs is ... was not an option for our birds flying in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found