Search the Community

Showing results for tags 'matterjs'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 19 results

  1. I am creating a platformer with Phaser3 and I am using Matter for my physics engine. I have loaded my tilemap/set into the world, however, I don't know if the collisions are working because since I have added in this code, my sprite has disappeared. Why is this? How do I get my sprite to appear again so that I can make sure he collides with the tiles? //Create tilemap const map = this.make.tilemap({key: 'map'}); //Create tileset const tileset = map.addTilesetImage('tiles'); const platforms = map.createDynamicLayer(0, tileset, 0, 0); map.setCollisionByExclusion([-1, 0]); this.matter.world.convertTilemapLayer(platforms); //Update the game at 30Hz this.matter.world.update30Hz(); //Get hitboxes this.shapes = this.cache.json.get('shapes'); //Set boundaries for physics this.matter.world.setBounds(0, 0, game.config.width, 750); //Player this.hero = this.matter.add.sprite(0, 0, 'sheet', 'run_right/0013', {shape: this.shapes.s0013}); //Don't want him rotating in the air this.hero.setFixedRotation(); //Set our variable to do calculations heroSize = this.hero.width;
  2. 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) - https://github.com/photonstorm/phaser/blob/8af70d02d1f42a0b56e618840d27b2d1807848cf/src/physics/matter-js/lib/render/Render.js Thanks!
  3. https://gyazo.com/4a44909a40952ac6f5182d328f55d754 I've spent more time than I care to admit figuring it all out. I'm calculating a convex hull around a sprite and then slicing it up into matterjs driven little orc pieces. I'm not very happy with one thing yet. Each of these pieces is a separate Sprite and it has it's own Graphics object as a mask. I feel that if I were to have a couple of these going at the same time rendering could get expensive. Teach me to do better I should be learning react or something to get a dev job, but here I am cutting up orcs.
  4. 1-) I am new at phaser and I look for phaser3 Matter physic tutorials. 2-) Is there a way to search in phaser3 tutorials. It is too hard to find proper tutorial. https://phaser.io/news/category/tutorial
  5. I would like to share a website I built with Phaser 3. I believe Phaser is going to change the way we interact with online content, and I would love to play a part in that change. Here is the website: https://cannabijoy.com/ Although I have a desktop version, I recommend you check it out on your smartphone. The entire website was built on my phone, so mobile browsers will get most of the attention. In fact, the only time I’ve used a PC is to make sure my code is working. The mini games are built to show off the capability of Phaser, but I’m currently working on a platform puzzler with my slingshot character. I do believe these are the first games built with Phaser that utilize a slingshot, and if my website becomes successful, I hope one day to teach the functionality in my tutorials. For now I’m trying to establish myself as a programmer, because I don’t actually work in this field. Any feedback will be greatly appreciated. Thanks for checking it out!
  6. 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 (https://labs.phaser.io/edit.html?src=src\physics\matterjs\collision filter.js) and setting the bounce (on line 31) to 3
  7. How do I enable MatterJS based physics in my group bodies? I have the following: this.bullets = this.scene.add.group({ 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 - https://phaser.io/tutorials/making-your-first-phaser-3-game/part8 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?
  8. 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.world, config.x, config.y, null, null, config.options); this.scene = scene; this.ship = this.scene.player this.graphics = this.scene.add.graphics(); this.path = new Phaser.Curves.Path(0, 0); } update() { this.graphics.clear() this.graphics.lineStyle(1, 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(this.graphics) } } export default Gun; Here's the live demo - https://codepen.io/jurbank/project/live/AmPBBN/ And the project - https://codepen.io/jurbank/project/editor/AmPBBN Any thoughts? Thanks!
  9. 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
  10. 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 - https://codepen.io/jurbank/pen/Mqqyow?editors=0011
  11. 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: http://labs.phaser.io/edit.html?src=src\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?
  12. 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 this.matter.world.on('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 - https://gitlab.com/grigoriytretyakov/phaser3-racing-car/blob/master/src/Game.js#L172
  13. 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
  14. 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.
  15. 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.
  16. 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. http://labs.phaser.io/edit.html?src=src\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 https://github.com/photonstorm/phaser/tree/master/dist
  17. 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.
  18. staff0rd

    ZigZag

    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
  19. 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!