How to reliably orbit a position with joints or any other way

I simply want a game object to orbit a fixed point on a plane. Imagine a standard model from school of the earth orbiting the sun.

What makes it complicated is that I also want my game object to still react to other objects, for example if it is hit from the front by a bouncy object it should change direction while still keeping its distance to the center point.

Before Unity, I build the exact same thing with Box2D (different Physics engine). I simply fixed a joint to the center point and the game object. Done.

In Unity, it does not seem to be that easy. The moment my game Object gets fast or is hit by another object, the joint will not stay in place. It will wiggle and the circular motion might even become more of a rectangle if movement is fast.
I tried a hinge joint with the hinge on top of the center Point and also linking a central object to the circling one via fixed joints and a long object in between.

I have learned that the problem can be helped by
a) lowering the minimum time step
b) raising the iteration count

I tried both options and they wont do for me, since keeping the distance in that case is really central to my game and
a) both options still won’t fix the problem completely
b) I am afraid that I will regain rectangular motion when fps drop, as the time step will then go up.

What I am now planning to do is to use Transform.RotateAround, thereby orbiting by hand. This means that i will have to handle any physics related Behavior myself, since Transform.RotateAround is not part of the physics engine, which means it does not cause any real movement.

That sucks.

So I would like to know:
Is there any other way to orbit a position? Or maybe even a way to make a joint stay in place, therefore reliably keeping a distance between an object an a point in space?

Try:

  • Add a configurable joint component
  • Freeze all motion and angular motion settings except the axis you want to rotate around (Y in my test case).
  • Move the object to the “track” and then positions the anchor at the center.
  • Turn on projection mode for position and rotation
  • Set Projection Angle to 0.01

In my simple test, I had minimal wobble with a solver iteration rate at the default of 6.

Given that you have a predictable track, you could also move the object with Rigidbody.MovePosition() and you could limit the velocity so mute the effects of large impacts. Changing the mass also can help. I gave the ball a mass of 0.1f in my test.