Splitting Geometries

Oct 5, 2009 at 2:58 AM

Hello all. I am developing an XNA game and utilizing Farseer Physics, which I am very excited about. I am attempting to create simple destructible objects. I have seen some examples in the threads, but I was hoping for just a general example of where to start. from what I've read, the seems the process will involve generating random intersection points about a main Geom (I'm planning on using all rectangular Geoms) and then some how splitting it so it sort of falls apart, Maybe even add some friction so they break apart realistically. Just hoping for some info, thanks ahead of time.



Oct 5, 2009 at 1:03 PM

With rectangles you will have to create something yourself. You could utilize raycasting. Simply pick a random place on the rectangle and cast a ray with a random angle that faces towards the rectangle. Take the two intersection points that it creates and "cut" there. The next cut will (potentially) cut both geometries and you will end up with 4 geometries.

Then again. If you add more points to the edges of the rectangles. (instead of only 4 - one at each corner) you can use a triangulation (or other decomposition) algorithm to split it up.

What is the purpose of the splitting?

Oct 5, 2009 at 7:29 PM

I just assumed splitting would be the easiest process. I am still reading the Farseer manual to learn some of these functions, specifically how to "cut" as you said. If there is a simpler or more logical approach, let me know. (I am researching triangulation algorithms as well, but it seems I will have to add a lot of functionality myself as well) Thanks for the reply!