Impulse Solvers and Contiuous Collision with Rotating Objects

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
spaceDoctor
Posts: 2
Joined: Wed Mar 01, 2023 3:48 pm

Impulse Solvers and Contiuous Collision with Rotating Objects

Post by spaceDoctor »

I have written a basic collision detection/resolution system using constraints and impulse solving, and I think I have reached a point where it starts to break down. In my sandbox, I have sphere's being acted upon by gravity, and my system works totally fine; smaller spheres will remain on the surface of the more massive spheres, and friction prevents them from rolling around. However, if I add some angular momentum to the larger object (let's call it a planet), the smaller object will begin to accumulate velocity and start circumnavigating the planet, eventually gaining enough velocity that it will leave the surface and reach a stable orbit!

Now, thinking about this, this seems to make sense: when colliding with an object that has some rotational velocity, the constraint solver will adjust both parties accordingly, and the angular velocity of the planet will obviously impact the non-rotating object. However, given that in my situation gravity is causing the smaller sphere to always be in contact with the rotating planet, the impulse solver will continually increase its velocity.

To test this, I hobbled together a crude implementation with raylib and bullet3 and found the exact same result: the smaller sphere gains velocity on a rotating sphere until it leaves the surface. I'm not suggesting that there is an issue with bullet, more so that I confirmed my system is indeed working 'as intended.'

Considering that I believe what I am observing is a feature of these constraint solvers, not a bug, how can one use constraints and impulse solvers to have an object remain stable on a rotating object under the force of gravity? Or would I need to go about collision response in a totally different way in order to have stationary objects on rotating objects? Perhaps there is another constraint that needs to be added other than normal and friction?

Thanks
spaceDoctor
Posts: 2
Joined: Wed Mar 01, 2023 3:48 pm

Re: Impulse Solvers and Contiuous Collision with Rotating Objects

Post by spaceDoctor »

After further tinkering, I've found that this only applies for sphere-sphere collisions. If we change our smaller object to a cube/box, then this problem doesn't arise. I've confirmed this with both my own implementation and bullet: a box under force of gravity will remain stationary on a rotating sphere.

Another possible solution would be to use sphere colliders broadly, but switch to a mesh collider when we have a continuous collision occurring.

I guess that technically solves this 'issue', but I feel like sphere-sphere should still be handled in this scenario. Hopefully someone smarter than I am can give an explanation, or a solution!
Post Reply