MrSnrub

Members
  • Content Count

    3
  • Joined

  • Last visited

  1. MrSnrub

    Phaser 3 Collision Group Matter.js

    Found out how to do this. For anyone that might be interested, if you have sprites with matter.js bodies and don't want them to collide, you can set sprite.body.collisionFilter.group = -1 to the ones you don't want colliding and they won't collide with each other but they will still collide with everything else. For more detailed info: http://www.iforce2d.net/b2dtut/collision-filtering
  2. Hi, Is there a way to use collision groups in phaser 3 for matter.js physics? I am trying to create a group of sprites that collide with the player but don't collide with themselves. Thank you
  3. Hi, I am trying to create a sprite whose texture comes from a graphic object, but each time I try to do it I get the missing image (green box with a slash). Could you point out what I'm doing wrong? I have tried the following two ways function create () { var graphics = this.add.graphics(); var color = 0xffff00; var thickness = 2; var alpha = 1; graphics.lineStyle(thickness, color, alpha); graphics.strokeRect(32, 32, 256, 256); graphics.generateTexture("test"); graphics.destroy(); sprite = this.add.sprite(400, 300, this.textures.get("test")); } function create () { var graphics = this.add.graphics(); var color = 0xffff00; var thickness = 2; var alpha = 1; graphics.lineStyle(thickness, color, alpha); graphics.strokeRect(32, 32, 256, 256); var texture = graphics.generateTexture(); graphics.destroy(); sprite = this.add.sprite(400, 300, texture); } Thank you