Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Offset Matter Physics Bounds?


LaserLemon
 Share

Recommended Posts

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.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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