Jump to content

Creating Groups with MatterJS enabled bodies?


jurbank
 Share

Recommended Posts

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'
2056295269_ScreenShot2018-09-21at8_29_39AM.png.a0d177e48d3465738a3e20619d99b4d3.png

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?

Link to comment
Share on other sites

I found that you can add a class type: https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.Group.html
 

    this.bullets = this.scene.add.group({
      key: 'bullet',
      frame: 0,
      repeat: 5,
      maxSize: 10,
      classType: Phaser.Physics.Matter.Image(this.world, 0, 0, null, null, {}),
      setXY: { x: 32, y: 100, stepX: 40 }
    });

Still not working though

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...