Search the Community

Showing results for tags 'matterjs'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 15 results

  1. I found in my project that when objects are moving fast enough the colliders no longer work. Do I need to be increasing the mass or something so collisions register when an object is moving fast? You can see an example by going to the Collision Filter example (\physics\matterjs\collision filter.js) and setting the bounce (on line 31) to 3
  2. How do I enable MatterJS based physics in my group bodies? I have the following: this.bullets ={ key: 'bullet', frame: 0, repeat: 5, maxSize: 10, setXY: { x: 32, y: 100, stepX: 40 } }); And I'm noticing the body value (at the bottom) is 'null' Based on this tutorial - It uses 'this.physics.add...' but unfortunately, 'this.physics' isn't available. Perhaps because I'm not using Arcade Physics? I also tried 'this.bullets.enableBody = true;' which doesn't seem to do anything. Thoughts?
  3. I'm attempting to clear the path within the update function, you can see below: But for some reason, the path won't clear class Gun extends Phaser.Physics.Matter.Image { constructor(config, scene) { super(, config.x, config.y, null, null, config.options); this.scene = scene; this.ship = this.scene.player =; this.path = new Phaser.Curves.Path(0, 0); } update() {, 0xcccccc, 1); this.path.lineTo(this.ship.x, this.ship.y); this.path.lineTo(this.scene.input.mousePointer.x, this.scene.input.mousePointer.y); this.path.draw( } } export default Gun; Here's the live demo - And the project - Any thoughts? Thanks!
  4. Hi all, I've been stuck on this issue for a few days now. I'm working on a game that relies on sleep events and removing the object beneath the matter physics image (so that it continues to fall). Only issue is after the sleep event is fired and I remove the image beneath the dynamic object, I can't get the physics object to move again. Any help would be appreciated. I would like to know if this is impossible as well so that I can look at other solutions. Thanks! Hugh
  5. Does anyone know how to disable wireframe mode and change body colors while using MatterJS for physics? I can see the following properties in the body's render object, but the color is not updating. It looks like wireframes are set to true by default (line 59) - Thanks!
  6. I'm trying to make a game where the user can drag parts to attach to the Ship. The main challenge I'm running into is attaching the bodies into a single, fixed group so when the player thrusts around with the arrow keys, the other bodies stay in-place. I was looking into composites but I'm not sure how to use them in Phaser, looks pretty straight forward in standard MatterJS. I was also playing with constraints and joints but those seem to attach at one point between both bodies. I also tried adding two constrains, one at each edge but it seemed like the 2nd overwrote the 1st. Any thoughts? Here's my code playground -
  7. Hi, I want to create this module, it's composed with 4 connectors and a main module. I created each using the: this.scene.matter.add.sprite I would like to be able to batch them togheter and simply call: module.setPosition(x, y) to move all of it. It would me nice too (but not required) if I was able to batch multiple modules to create a space station and be able to move everything. I Tried with Matter Compound Bodies, but it seams that it can only compound matterjs pure bodies, not those with sprites attached to it. * I followed this example:\game objects\tilemap\collision\matter platformer with wall jumping.js I saw the new container feature but I dont know if it supports physics objects nor I was able to test it with the container branch. Can you guys help me pointing to a direction?
  8. Hi guys, I have different objects in my game, something like this scene.matter.add.image(x, y, 'car'); scene.matter.add.image(x, y, 'cone1'); scene.matter.add.image(x, y, 'man'); And I try identify what kind of objects collides'collisionstart', (event, bodyA, bodyB) => { if (bodyA.label === 'car' && bodyB.label === 'cone') { bodyB.cone.body.setTexture('cone2'); } if (bodyA.label === 'cone' && bodyB.label === 'car') { bodyA.cone.body.setTexture('cone2'); } if (bodyA.label === 'man' && bodyB.label === 'cone') { bodyB.cone.body.setTexture('cone1'); } if (bodyA.label === 'cone' && bodyB.label === 'man') { bodyA.cone.body.setTexture('cone1'); } }); But sometimes cone object don't change his texture despite I hit it by a car. If it can help, full code there -
  9. Hello, I am new to phaser and trying to learn phaser 3. I need a revolute constriant for a project. There are examples for phaser 2 using box2d and p2physics, but they wont work in phaser 3. I tried looking that in documentation but i don't think it is complete yet. Can anybody please tell me how to create a revolute constraint (or pin joint) in phaser 3 (preferably in matter js). Thanks
  10. Hi everyone, I'm pretty new to Phaser, only started with it yesterday. I'm building a world with some image assets, in this case, trees that my player object will have to collide with. The code looks like this: var treeLeft = this.matter.add.image(0, (gameHeight - 96), 'tree', null, { isStatic: true }).setOrigin(0, 1); As you can see I'm adding them with Matter.js and then telling them to be static. However, my setOrigin(0, 1) is throwing off the bounding box that Matter.js assigns to the image object. Do you know of any way to make the physics bounding box coincide with my image's visible bounds? I'd like to keep the setOrigin as is because it simplifies the actual map building process for me greatly. Thanks in advance, Emile.
  11. How can I set the direction at which an object should be moving at in MatterJS physics? In Arcade physics I'd do `this.scene.physics.velocityFromRotation(angle, this.speed, this.velocity);`, but MatterJS doesn't seem to have a `velocityFromRotation` method.
  12. Hey guys, I'm trying to recreate the example code in Phaser 3 from this sample code as it seems Matter.js is much better suited for what I'm trying to achieve than Arcade and wanted to just get an example working locally.\physics\matterjs\attractors.js When I run this in my own project I get ` this.matter is undefined ` Is there a separate script I'm meant to include like there was in the dist folder for 'phaser-arcade-physics.js' on the repo
  13. I'm using Matter.js as my physics engine and Pixi as my renderer and under normal circumstances I've been able to get them to work smoothly. However, I'm trying to do something where all of the objects *except* the player character are scaled down to look like the character is now above them. The scaling works visually in Pixi, but I can't get the bodies from Matter.js to go with it, so there are these "ghost objects" that I can't see but if collide with them then the scaled down objects will be moved. Does anyone have any tips for how to resolve this? Let me know if I need to post a gif if that would help explain the problem.
  14. staff0rd


    ZigZag is a short, re-imagining of the classic Snake game - and another collab with @TM999. Uses pixijs which I've become quite familiar with now, and is my first attempt at integrating matterjs. I'm again using GSAP for all movement, and howlerjs for sound. matterjs is in there for collision detection, but due to the nature of the game I don't need to update the physics every tick, rather I call an update on the engine only when the player performs an action. I'm completely new to physics engines, and the static? structure of matterjs functions took a while to get up to speed, but once you get a feel for the library it works pretty well and seems quite performant. There is some glue required considering pixijs is responsible for the graphics scene tree, and matterjs is responsible for the bodies, but the end result is quite nice, so I do recommend others to try matterjs if you haven't already. Play on Web Play on iOS Play on GooglePlay
  15. Matter.js v0.8.0-alpha a JavaScript 2D rigid body physics engine for the web DemoMobile DemoFeaturesUsage DownloadDocumentationChangelogIssues Project PageGitHubCodePenTwitterLicense (MIT) It's about time I opened a thread here for this, since I just released a new version! Matter.js is (another!) 2D physics engine for HTML5 games. Competition is always good It's currently still alpha, but it's pretty stable and performance is very good (e.g. the mobile demo pulls 60FPS on a Nexus 4). Note that it's not a complete game engine or a framework, but it has the components to get started including a game loop and renderer. See the links at the start of the topic for lots more info. Hope you guys like it, cheers!