Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using Farseer physics engine.

I have a simple rectangle body and would like it to split into two pieces given a starting coordinate (where the bullet enters the object) and ending coordinate (where it exits).

share|improve this question

1 Answer 1

up vote 2 down vote accepted

A common technique for creating cutaways or cross-sections is to use an arbitrary clipping plane to exclude a part of the body. By cloning the body and clipping an opposite part of the body you end up with two pieces of something that appears to have been sliced in two.

You would then have to use the stencil buffer to 'fill in' the clip edges, and create new physics bodies for the two new bodies.

http://glbook.gamedev.net/moglgp/advclip.asp

share|improve this answer
    
Thanks. Unfortunately, I don't have access to the stencil buffer. Is there a way of doing it in Silverlight? –  Skoder May 3 '11 at 16:28
    
You could try replacing the original mesh with two new meshes. Using the points of intersection of the cut, and using those points as the new vertices for the new meshes. –  Kitt Basch May 4 '11 at 10:06
    
I guess this will be the best way to do it. Thanks. –  Skoder May 4 '11 at 15:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.