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 reaction to device's gyro and orientation change.
I'm using MatterJs for a physics based game and have not found a solution for the problem of preventing bodies being force-dragged by the mouse through other bodies. If you drag a body into another body, the body being dragged can force itself into…
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.js
Matter.js
I am using Matter.js physics in an attempt to create soft bodies. I was able to create a body like this:
However I am not sure if this is the "soft body" I want. It is true that this body is not entirely rigid and has that bouncy feel when it…
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, mouse.position);
Now I need to apply a force, to…
I'm trying to override the default canvas size that is set to: 800x600
After some digging in the documentation I found:
Matter.Render.create([options])
And the options that seem interesting are: render.options.height and render.options.width.
How…
As already mentioned in the title, I am looking for a way, to disable every collision of a body in Matter.js. It should still be linkable with Constraints, and there should be the possibility of enabling the collision again after some time. Is there…
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 ground = Bodies.rectangle(400, 610, 810, 60, { isStatic:…
I am trying to detect when two object collide with each other, but I am not sure how to do it.
I have the following scene, which adds two physics images to the scene. I just need a way to detect when the two collide.
export class MainGame extends…
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 global, but the current file is a module.
Consider…
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:
Physics test