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

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