Skip to main content

Questions tagged [matter.js]

Matter.js is a 2D physics engine for the web

matter.js
0 votes
0 answers
24 views

Style matter-js bodies

I Want To Create This Ping Effect. You can see more about it on https://stake.com/casino/games/plinko I'm re-building this plinko game and want to create this effect of a 'ping'. I got to a point ...
Ibra's user avatar
  • 1,042
3 votes
1 answer
107 views

Setting fillStyle works inconsistently for bodies in Matter.JS

I'm working with Matter.JS for an interactive header graphic on a website. I have some basic letter paths in SVG, which get loaded, converted to shapes and bodies and placed in the world. They get ...
oelna's user avatar
  • 2,378
2 votes
0 answers
35 views

WARN: matter-js: Matter.Engine.update: delta argument is recommended to be less than or equal to 16.667 ms

I am using matter-js with react-native-game-engine to create game with a falling body. And then, in setupWorld() function I am defining them, like this: class GameScreen extends Component { ...
JeremyFc's user avatar
  • 177
1 vote
1 answer
42 views

How can I prevent dragging body beyond specific area with MatterJS?

TLDR; How do I make a body draggable only in the bottom half of the screen and release it if user tries to go beyond that specified area? I'm making a simple game using p5.js for rendering and Matter ...
Worker1432's user avatar
0 votes
0 answers
82 views

Error loading images in a React + p5.js project

THE ERROR: This error appears if I use loadImage() function, even if I didn't use the image loaded anywhere else. In this case it is the background image, but even loading images I just want to use on ...
Worker1432's user avatar
1 vote
1 answer
43 views

How to reset ball position if it goes out of bounds, using p5.js and matter.js?

I want to reset the ball back to its initial position if it flies off the screen, or if its position.y < 0 (I'll add in other boundary conditions once this is figured out). I tried simulating that ...
Worker1432's user avatar
1 vote
1 answer
25 views

Why is there a loss of energy in matter.js newtons cradle?

In the live simulation available at https://brm.io/matter-js/demo/#newtonsCradle, how can the issue of energy loss be resolved? Despite setting friction to zero, energy loss still occurs. Does anyone ...
texi's user avatar
  • 50
1 vote
0 answers
44 views

Phaser 3 collision - ball is disappearing in specific collision situations resulting in NaN values for velocity / position properties

I have a simple basketball shooting game built in Phaser 3. It has a ball, a rim with a point on each side where the ball can bounce off of, and a zone underneath the rim that I use to track for ...
Jimmy Blundell's user avatar
1 vote
1 answer
54 views

How to conditionally turn on/off collisions in Phaser 3?

I'm making a simple flick type basketball game. The game is 2D, but the ball scales smaller after you launch it to give the 3d effect. Where the ball spawns, the rim of the hoop is directly above it ...
Jimmy Blundell's user avatar
0 votes
0 answers
26 views

Matter Js on live server

I am using matter js in my project but it is not visible and throws an error in the console using the live server extension "matter.min.js:6 Uncaught DOMException: Failed to execute 'drawImage' ...
Yash kolte's user avatar
0 votes
1 answer
39 views

How do I prevent collision between bodies in a stack using MatterJS?

Using MatterJS I have a stack of circles and a floor rectangle: var stack = Composites.stack(300, 0, 3, 3, 10, 10, function(x, y) { return Bodies.circle(x, y, Common.random(10, 20), {friction: 0, ...
user500665's user avatar
  • 1,302
0 votes
0 answers
23 views

Converting gyroscope values consistently across Android and iOS with Matter.js

I am using the Matter gyro demo in my project and it works perfectly on Android. However, I'm not able to achieve consistent results on iOS. This is the relevant snippet I have taken from the gyro ...
Sel's user avatar
  • 352
0 votes
2 answers
51 views

How do I change the gravity when the Enter key is pressed

So I made a little matter.js thing, using javascript and html, it just creates a black floor, where which a rectangle, trapezoid, square, and circle fall on it: <!DOCTYPE html> <html lang=...
Z_Dev's user avatar
  • 23
0 votes
0 answers
34 views

In Matter.js, using SVG objects created "fromVertices" I can't "applyForce" or setVelocity on those bodies

When adding convex SVGs to a matter.js canvas (using the polyfills so they look fine) the movement of these bodies when forces are applied is not correct. I can barely move the bodies at all even when ...
Luke Walker's user avatar
1 vote
1 answer
42 views

Add/parent physicsless sprite to matterjs vertexbody such that it moves with the body. PhaserJS using MatterJS

const poly1 = this.add.polygon(200, 200, Ployploy, 0x0000ff, 0.2); ThisPlayer = this.matter.add.gameObject(poly1, { shape: { type: 'fromVerts', verts: Ployploy, flagInternal: true } }); //add this ...
Brenden McGraw-Hobbs's user avatar

15 30 50 per page
1
2 3 4 5
22