2D Physics System

There’s still problems with my code such as with fast-moving thin bodies & also with intersecting vertices where neither vertice is inside the other shape, which you’ll see in the next demo. I think I can only solve it by using intersections (as bleb prescribed), but I’ll apply the forces at each bodies’ vertices, not at the intersections themselves (this shouldn’t require too much extra work).

Until I solve this I think its best to keep your working code away from my buggy version. If you want to add my project on to google code and have the two going in parallel that’s fine.

Thanks for offering to integrate them. Hopefully I will be able to do most of it - at least the parts that only I understand. I’ll post the new demo & code soon.

Keith

PS: I haven’t changed too much except for what I said before: making the bounds a max radius from a centroid point.
The only other important change was using Point2D.Float class rather than Vector2f - but that’s not too much work to change.

I don’t really like Point2D.Float anyway since you can’t serialize it or extend it. Though I’d like to add some more methods to Vector2f if you don’t mind - like setX, setY, getPoint2DFloat() and let it implement Serializable.

http://www.freewebs.com/commanderkeith/screenshot3.png

Web Start: http://www.freewebs.com/commanderkeith/PolygonPhysics.jnlp

Demos 11, 6 & 9 show the problems I mentioned - I think both can be mitigated by using line intersection.

I think this could be used by someone to make a cool Worms type of game :). I’ll give it a go eventually too
.
Keith

@Float vs Double: Don’t forget that opengl uses internally only floats. So the speed gain might be lost due the downcast from double to float.

Hi,

I just want to let people know that I won’t have time to work on this project until November.

I haven’t lost interest at all - I’ve just got a deadline on the 30th of October that I’m running late for. I will get the polygons working seemlessly in November :).

Keith

Good to know this hasn’t been abandoned. :slight_smile:

Looking forward to the newer versions