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

[Box2D] Multiple sprites for one body


eddieone
 Share

Recommended Posts

I think groups are not really possible with Box2D based on a post by Rich some where. Instead, I have made some text follow the player by setting it's x and y relative to the player's positions. It's look alright but has a floating appearance like the body moves away faster some of the time. Is there a way to get multiple sprite attached to a body without any floating?

float-name.gif

Link to comment
Share on other sites

Hi, just use addChild on sprite. Added child sprite will not have body, but will move along with parent.

Look at image below - for test I added explosion as child to ball (with 50, 50 offset). As debug draw is on, you can see, that ball has body, while attached explosion not. If you need more complex collision shape, solve it through adding more fixtures to body.

Ball.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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