Sphere-to-Sphere and Wall collisions. Need help with common bugs

Hey guys!
I’ve been experimenting with collisions without Box2D and other addons, just regular vectors. The examples are very common but here is a very well explained one:
There is also an example in Programming Interactivity. :slight_smile:

My question is about common bugs in these types of codes. I’ve made a sphere generator in the center of a scene and they generate every second, I’ve also forced the application to have many many spheres on scene. I’ve noticed that some spheres tend to be forced into a corner and start having motion flicker, probably because both wall and sphere collisions are happening at the same time and both types of collision conditions are met.

Bug type 1 happens when spheres colide in a corner.
Bug type 2 happens with one generates a sphere less that a radius away from another.

How do you guys deal with this types of common extremes?

can’t help you without code!

Thank dr.mo but I think I got it. I was making the wall conditions too long and I was letting my memories of physics in Just Cause 2 impair my judgment.
The code is in that gamedev website but thanks anyways. :smiley: