I went back to my original scaling algorithm based on the player controller because I found it to be more debuggable. Then, I found the logic causing my planets to stop moving prematurely:
if (stopGravityDistance < stopMovementByStopGravityDistance)
I removed that conditional from my script and immediately saw better results. However, I’d like a way to get the bodies to overlap and eventually stop moving each other.
I switched startScaleDistance from a global variable to one dependent on the attractee and attractor’s unscaled sizes. Now, when their bodies touch, scaling begins.
After adjusting my parameters, overlap seems to work as intended. I was even able to remove several variables from the algorithm, including the one’s above. I’m not sure why stuff suddenly works, but I’ll take it!
Now that attraction with multiple bodies is working, I can technically proceed to my next scene. However, I wanted to refine this even further by getting the objects to fully stop moving relative to each other once merged.
To accomplish this, I corrected a flaw in my counter-force logic where I was using the velocity of the attractee instead of the its relative velocity to the attractor. Because of this, the merged objects never properly stopped as long as they were moving in a direction. I adjusted my stop velocity and stop moving distance, and now this is the result.