Advertisement

rigid body collisions?

Started by June 01, 2003 06:13 PM
11 comments, last by JtM 21 years, 8 months ago
>a) decide which endpoint passed through the other line
>b) move the offending endpoint, along with the endpoints of the line that was penetrated, just enough that the intersection does not occur any more

You should assign masses to the points of each object. Let us say an asteroid masses 100 ton (or whatever units) and has 6 points then give each point 100/6 tons mass.

When detecting an intersection you move the intersecting point AND the two points of the other object making up the edge you crossed. How much you move each of them depends on their relative masses.

If you do it this way you''ll get more realistically looking collisions without having to do real physics.

For objects that shatter you simply change which edges connect what points and add some more edges/points. As long as you do not change the mass of the entire system it should behave reasonably real world like.
/ Bucko aka Backman
AP: Should be interesting to see how you''ve implemented it. My email is jtm@austarnet.com.au if you don''t mind sending it. I''m doing mine in c++ but I might port it to java one day (I''m doing java in CS atm). Thanks for the support btw.
-JtM
Advertisement
You can download it from the page given above.

There is a newer version that has cleaner code and a few improvements to some important methods, but it''s on my network-card-less laptop and it''s a real hassle finding a machine in the computer lab with a working floppy drive. I''ll probably put it up at some point though.

The good things about my system are: the sweep-line algorithm for collision detection (although the implementation in this version is nasty), a nifty method for computing the area of an arbitrary polygon, and the ability to save the simulation into an XML string.

I should really get myself an identity...

This topic is closed to new replies.

Advertisement