# 2D circle physics with gravity...stability problems, help?

This topic is 4368 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I used the Gamasutra "Pool Hall Lessons" [1] article to develop a nice, working collision prediction/response system for my 2D colliding-discs game. So far, so good: I predict the next collision, run the simulation to that time, process the collision, find the next, run to it, repeat repeat repeat. The problem comes when I introduce gravity. Predicting the collisions is still no trouble: the same movement equations for disc-to-disc collisions work fine since they are all accelerating uniformly. Collisions with stationary walls are only trivially harder since you have to solve a quadratic. The real problem is stability. Once the balls start stacking up on the floor, the collision rate increases exponentially and my engine chokes. I've tried a couple of schemes for detecting when a disc is "stable" and dropping it out of the simulation until it gets hit, but I can't seem to make it work. Does anyone know of some good methods? 1 - http://www.gamasutra.com/features/20020118/vandenhuevel_01.htm

##### Share on other sites
This is the algorithm that i use to deactivate and activate things:
Deactivation:
deactivate an object when it stays in the same position and rotation(with in a threshold) for a certain amount of time. In addition, i only deactivate something if there's an object that's touching it and under it that's also deactivated (the floor starts as deactivated and stays that way)

Activation:
activate an object if it's linear or anguler speed goes above a certain threshold. then recursivly activate all the objects touching this one whose COM is above the current objects COM.

EDIT: this is similer to MrRowls algorithm in JigLib (google for it to get some great tips for making a physics engine.)

##### Share on other sites
Thanks very much, daniel_i_l!

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 9
• 15
• 14
• ### Forum Statistics

• Total Topics
634071
• Total Posts
3015336
×