matter.js Questions

1

I made a BallCabin with Matter.js in DOM (render BallCabin on div element), it perform OK. But same code, when I put it into pixi.js project, I found nothing is displayed. I'd like to how can I ren...
Lund asked 24/3, 2023 at 8:2

3

Im trying to apply a force to an object. To get it to move in the angle that my mouseposition is generating relative to the object. I have the angle targetAngle = Matter.Vector.angle(myBody.pos,...
Mutualism asked 6/3, 2016 at 12:49

3

Solved

Is there any way to disable gravity in Matter.js? I want my objects (bodies) to keep their physical abilities (like reaction to collision, restitution, friction etc), but I'd like to prevent the re...
Rutledge asked 6/4, 2015 at 6:48

4

Solved

I'm trying to use the matter.js physics library. I'm using their "getting started" tutorial, but it can't find the canvas. Here is my html: <html> <head> <meta charset="UTF-8"> ...
Cripple asked 21/1, 2015 at 23:58

4

Solved

I'm working with matter.js on a small project. I'm tryin to change the background color of the canvas and add custom colors to objects. Does anyone know a tutorial or something for styling matter...
Kirshbaum asked 27/3, 2014 at 11:58

1

How do i gradient fill a body created in matter.js? I have tried this but it won't work: Bodies.rectangle(400, 520, 800, 120, { render: { fillStyle: 'linear-gradient(50%, red, blue)' } );
Longwinded asked 29/6, 2021 at 8:26

1

I am using Matter.js to build games. Starting from one of their examples: Pyramid, I started playing around. The code fro this specific example is as follows: var Example = Example || {}; Example...
Hackle asked 21/10, 2018 at 11:27

4

Solved

I'm wanting to place font or static images onto the canvas but not sure what the best approach is using Matter.js. Right now, for images, i'm just creating a body with a size of '0' and putting the...
Experimental asked 25/9, 2014 at 16:16

2

Is it possible to create a single gravity / force point in matter.js that is at the center of x/y coordinates? I have managed to do it with d3.js but wanted to enquire about matter.js as it has th...
Warrantor asked 11/8, 2015 at 9:30

2

Solved

I am working off the Slingshot demo. The problem is that after the rock is fired, it can still be clicked on and dragged around, which I want to disable. I've added a filter to the rock: var rockOp...
Glorianna asked 10/11, 2020 at 16:27

2

Solved

So I am making an Angry-Birds game and I am using p5.js and matter.js. I created a mouseConstraint in the game to move the bird attached to a slingshot, but I am also able to move all the bodies in...
Geny asked 5/8, 2022 at 16:44

1

How to make a video attached to a matter.js body/composite? var body = Bodies.circle( Common.random(10, render.options.width), Common.random(10, render.options.height), radius, { render: { s...
Finella asked 21/11, 2021 at 21:44

2

When a sphere falls I would like to put images inside but it doesn't work with the fillStyle render I can only color, now with sprite I can but they don't fit the circle unless the image is rounded...
Rondon asked 1/6, 2022 at 22:50

2

i have some rectangles created with Matter.js, like this: Bodies.rectangle (getRandomInt (200,400), 50,140,50, {restitution: 0.7, timeScale: 0.5}) But now I need is to add a text inside that rectan...
Backchat asked 1/7, 2020 at 16:37

2

I have some code like the following for the matter.js library: // create two boxes and a ground var boxA = Bodies.rectangle(400, 200, 80, 80); var boxB = Bodies.rectangle(450, 50, 80, 80); var grou...
Sternick asked 4/2, 2015 at 14:51

4

Solved

I'm using matter.js as a physics engine, and I see that I can detect collisions. However, I cannot figure out how to tell if two bodies are in contact with one another after a collision occurs. Is...
Indifference asked 4/1, 2018 at 5:46

1

Solved

I'm trying to use Matter.Query.region to see if the character in my game is grounded. But, when I try to run region with a bounds object that I created (displayed with the dots shown in the game), ...
Placatory asked 7/1, 2022 at 16:56

5

Solved

I found this file : https://www.npmjs.com/package/@types/matter-js i execute this line : npm install --save @types/matter-js In root ts file i got error message : 'Matter' refers to a UMD...
Desantis asked 9/4, 2018 at 13:53

1

I'm new to matter.js and I'm using Body.applyForce to move my box in a platformer I'm creating. I was wondering if there was an easier function to use that allows constant movement instead of just ...
Humboldt asked 17/7, 2021 at 1:36

7

I'm working on a project using Matter.js where I want gravity enabled in general, but I want to be able to disabled and re-enable it for a single object at certain times. I do not want to set that ...
Blakeslee asked 6/4, 2016 at 23:18

4

I am working on a top-down physics based game set in space. I would like the rotate to the view to always show the player's ship facing up even though the ship can rotate. I've searched through the...
Gunmaker asked 7/7, 2016 at 4:22

1

Solved

I want to render custom HTML elements as Bodies in Matter.js. I am using it in React which adds a bit of complexity but it's irrelevant to my issue. I've searched a lot and the only example I found...
Infinite asked 15/9, 2020 at 16:31

1

I know in traditional HTML5 canvas, we can use drawImage method (the longest one with 9 properties) and change frameX and frameY to make sprite sheet animation. But I am new to matter.js. I've chec...
Vincentia asked 8/12, 2020 at 22:27

1

Solved

What I'm trying to do: Use a Font Awesome SVG - sleigh - in matter.js. I've tried this: Matter.Bodies.fromVertices(500, 50 , Matter.Svg.pathToVertices("sleigh.svg")) <svg xmlns=&quot...
Spotweld asked 11/12, 2020 at 14:43

1

I'm new to Matter JS, so please bear with me. I have the following code I put together from demos and other sources to suit my needs: function biscuits(width, height, items, gutter) { const { Eng...
Swansea asked 19/10, 2020 at 17:35

© 2022 - 2024 — McMap. All rights reserved.