Jump to content

matterGameObject


iKest
 Share

Recommended Posts

Good day. I make pool with containers and i need add to containers matter body without add this in matter world. i do it through:

this.container = getCustomContainer(this.pool)
this.matter.add.GameObject(this.container)
this.matter.world.remove(this.container)

...


this.container.SetBody(...)

and it seems to me not right...

Link to comment
Share on other sites

It's very hard to understand what you're saying. An actual code example on codepen would help. If you need to add matter bodies to a container then I don't think it's possible. Containers can only have one body AFAIK. If that's not what you meant then perhaps you're using setBody wrong. The code below worked for me. There's no usage description of it but you can get a guess of what you need to pass there from here: https://github.com/photonstorm/phaser/blob/v3.11.0/src/physics/matter-js/components/SetBody.js

this.container.setBody({ 
   type: "circle",
   x: your_x_position,
   y: your_y_position
});

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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