Skip to main content
gamedev.net
🔒 Locked

Simple 2d physics simulator

Started by simucal 0 replies 800+ views
Original Post
simucal
simucal
For a project here at the university I created a simple 2d physics simulator. It allows you to create balls and shoot them off in any direction and watch them collide with each other, the walls, etc. Gravity, Coefficient of Restitution's, etc are taken into consideration. Each balls color is based off its speed vector (red = not moving, green = moving quickly). Quick Screenshot: http://img511.imageshack.us/img511/654/ballbounce3ee5.jpg It's loads of fun to create a ton of balls, resize the window to bunch them up then quickly maximize it and watch them scatter/flow. Source Code: http://www.filedropper.com/src_2 Compiled Executable: http://www.filedropper.com/ballbouncebin If you feel like giving it a try you can compile those few .java files in that rar there or just run the executable from the second link. My question is, what should I do next? I'm interested in making it more realistic for one. I haven't implemented any ball-rotation/momentum yet and I know that would help. What should I do besides that? Should I implement a less naive collision detection method (currently I'm simply detecting overlap, fixing the overlap and then adjusting their impulse vectors). What else could I do to make it more realistic or more fun? I'm considering adding in other objects than just the spheres.. such as polygon objects but I think I should have a more advanced collision detection system before I do that. Suggestions wanted and welcome.
jdindia
jdindia
It really depends on what you hope to achieve.

If you're trying to slowly develop an actual physics engine, then convex objects, rotational effects, spatial partitioning, friction, etc are all fine things to add.

If you want to have fun playing with just some aspect of physics, then try modeling the balls breaking apart when they collide or jello balls that wobble and jiggle around.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.