This project has moved and is read-only. For the latest updates, please go here.

how to break bodies without using breakablebody

Topics: Developer Forum, Project Management Forum, User Forum
Oct 12, 2010 at 6:18 PM

Hi, everybody.

I am gonna to break body with the image according to it.

But I can't use the breakableBody.

Because the body size and shape is random and the image is regarded to the body.

How can I do?

Oct 13, 2010 at 9:09 AM

Is there nobody to teach me?

Oct 13, 2010 at 7:58 PM
Edited Oct 13, 2010 at 7:59 PM

I'm assuming you're using the sprite-to-polygon demobase example.

You can still use breakable body; the simplest solution would be to manually break the sprite into several parts. When you want it to be split, create bodies and draw sprites according to the split1 and split2.


One subject you might be interested is sprite splitting

which demonstrates how you can draw different parts of a sprite

Oct 14, 2010 at 4:51 AM

Thank you for your good sample for spritebatch.

but it is not using farseer engine.

I mean the serveral parts are too small bodies.

I can break the image but after breaking it, the parts must move like the body.

I mustn't control the parts.

understand me?

Thank you again

Oct 14, 2010 at 7:39 AM

blackdragon, thefnorder is giving you a hint on how you could solve your problem by splitting the sprite before using it in Farseer. Don't expect to receive always the code exactly for what you are looking at. Maybe you should provide more detail on what you need, like if you are really using the sprite-to-polygon.

Oct 14, 2010 at 7:49 AM

I have not required the exact code.

and I thank you for thefnorder very much.

There is no question about it.

But I need the way on how the broken parts move like real body.

for example, after one body is hitted by another, the body is broken and the parts of it have their own moving energy.

That's why, although I don't control the parts of sprite, they can be moved by themselves.

Understand me?

Oct 14, 2010 at 7:51 AM

aha, I have a good example.

Do you know the game angry birds?

Look at this.

I want to break the bodies like this game.

Oct 14, 2010 at 9:12 AM
Edited Oct 14, 2010 at 9:13 AM

When the body breaks, you have to create a new body for each piece that comes apart.

So if the unbroken body is made up of pre-divided fixtures, you just have to create a new body for each of those fixtures, add the fixture to the new body, and add the new body to the engine. And at the end remove the old body from the engine.

Hope that helps, was that what you wanted to know?

Oct 14, 2010 at 9:36 AM

Thank you, I will try

Oct 18, 2010 at 8:34 AM

hi robertdodd.

I have changed my decision .

I am gonna to use the breakable body.

But I don't know about it.

can you give me simple sample?

but I know the way to use the breakable body using FixtureFactory.CreateBreakableBody;

i need the way to use the new breakablebody.

most important is the vertices list used in breakable body.

I don't know how I can create the vertices list well.

 i need a simple sample for it