Jump to content

Box2D Plugin how to use removeFixture?


Recommended Posts

I have a R.U.B.E. loaded body containing two fixtures. One is named square, the other is named circle. How can I remove the square fixture with code? I'm trying to create a block that turns into a wheel when clicked on and starts rolling.
I am getting the body using game.physics.box2d.getBodiesAtPoint(x, y), but can't figure out how to target the fixture and remove it. bodiesUnderMouse.removeFixture('square') or bodiesUnderMouse.removeFixture(0) results in TypeError: a.GetBody is not a function.

Changing it to dynamic using bodiesUnderMouse.static = false works fine, so the body is found.

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.

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.


  • Recently Browsing   0 members

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