337 questions
1
vote
1
answer
59
views
Manipulate matter.js Body
I run into an issue with generated bodies in matter.js.
if i generate a body from svg via:
Matter.Svg.pathToVertices(svgPath, 1)
It can happen that the generated Body consists of more shapes like ...
3
votes
2
answers
109
views
Create physics body from svg in phaser with matter.js
I'm loading a svg as xml in the preload function:
this.load.xml("xml-pipe-bottom", "assets/svg/shape_pipe_b.svg");
and create a body and the svg as sprite:
const shapeBody = this....
0
votes
1
answer
48
views
MatterJS Ball Not Affected by Gravity in version 0.20.0
I'm trying to integrate a game, built with matter-js, into my existing SvelteKit webapp but am getting stumped as to why gravity is not affecting the circle body I'm adding. The following is the ...
1
vote
1
answer
36
views
How to add a Matter.js MouseConstraint to an svg viewbox element?
I'm trying to use Matter.js for it's physics engine while using D3.js for rendering the Matter physics bodies as SVG elements.
This demo is just a box dropping onto the ground. Everything works as ...
0
votes
1
answer
35
views
How to fix error "Composite.add is not a function" caused by code not yet run [duplicate]
I am making a project using MatterJS. However, I am having some difficulties. Whenever I run my code it throws the error TypeError: Composite.add(...) is not a function. I asked about the problem in ...
1
vote
0
answers
47
views
Creating functional flippers for a pinball game with p5.js and Matter.js
I am creating a pinball game for a school project. I am using p5.js for graphics and Matter.js for the physics. Everything else in my code is working except for the flippers, which keep firing ...
2
votes
1
answer
42
views
How to disable Bounce
I want to disable bounced in my io game. Main idea to set object (player) velocity and player must move until io socket command stop movement.
sample this.objects[id].setVelocityX (-speed);
to prevent ...
0
votes
0
answers
24
views
Why are the results always different from my tests?
I am currently developing a Plinko game using Matter.js. I’ve written code to ensure that the result is always determined by the ball’s initial position, without any external influence.
For example, ...
0
votes
0
answers
46
views
Instability of the components in the Matter JS engine
I am simulating a snooker game via JavaScript using the P5 and Matter JS, I'm almost done but I'm having trouble with some of the ball behaviors.
I added all the balls to the engine world in Matter JS ...
2
votes
0
answers
12
views
I want to achieve the effect of chain adsorption, but the end cannot stick tightly
I want to achieve a situation where, when I drag the end of the chain to the object on the right, the end sticks to the object (i.e., both sides are parallel). However, I tried adding constraints to ...
0
votes
1
answer
69
views
How to set different collision filters on compound body parts
I am trying to use a 2D physics engine to model a rotating disc with a pin on its edge. The pin can collide with other objects, either preventing the disc from rotating further, or pushing the other ...
0
votes
1
answer
54
views
Matter.js - Handling collisions at high object speeds in matter.js
I'm currently working on a space flight simulator using matter.js as a game engine. I'm facing a problem with the huge size of the map. If we consider that 1 metre is 10px (adjusted to the size of ...
3
votes
1
answer
171
views
Matter.js with custom renderer runs twice as fast as it should
I'm trying to use JavaScript to make it so that when certain pieces of text in the document are clicked, they become physical objects and drop down to the bottom of the screen. I'm using matter.js to ...
1
vote
1
answer
32
views
No friction on tweened sprite
I have a moving platform and box on top of it. No matter how fast the platform is moving, the box doesnt move sideways along with the platform and eventually falls down if the platform slipped away.
I ...
0
votes
0
answers
17
views
What's the difference between Body.setAngularVelocity and Body.setAngularSpeed
Usually the term velocity includes a direction and a magnitude component, but setAngularVelocity only takes a scalar value. I see setAngularVelocity also sets angularSpeed, but as an absolute value, ...