I have a large asteroid object, and I want to use physics2D to have smaller objects be attracted to it as if by gravity, and come to rest on its surface. The asteroid itself is also a dynamic physics2D object to allow it to drift around, and receive transferred momentum from impacts.
My current arrangement on the asteroid object is:
- Smaller CircleCollider2D on surface of asteroid asset for collisions
- RigidBody2D
- Larger CircleCollider2D for point effector
- PointEffector2D with negative force to attract objects
Other objects are just colliders and rigidBody2D's
The problem is that when an object comes to rest on the surface of the asteroid, since it has not reached the actual point effector coordinates, a force is still applied to that object in the direction of the point effector ie center of the asteroid. This force in turn gets imparted on to the asteroid, and if several objects build up in a certain direction the asteroid will move in the opposite direction.
How can I approximate the behavior of a real asteroid whereby an object will impart some momentum on impact, but once they come to rest the forces reach equilibrium?
Obviously in real life the center of gravity would be slightly altered, I don't need that level of precision. I just don't want the asteroid zipping around.
I have tried using the collision masks / matrix. I can not find a configuration that both allows the asteroid to collide with the smaller objects, but not receive the force imparted by them after colliding.