Rotate a weapon in a circle around player

I’m making a 2 player game where the player controls a moving blue circle, but also wields a purple hammer which they can swing around them in a circular arc to hit a hockey puck with force:


I have tried various combinations of components and parenting to get this to work. My most recent attempt involves putting a dynamic 2d rigidbody on the player circle, a dynamic 2d rigidbody on the hammer, then connecting the two via a 2d hinge joint. I then have a script attached to the player circle which rotates it using the rigidbody2d.MoveRotation(float) function.

The problems with this approach are:

  1. The player and hammer both rotate around the median center of the two objects. What I actually want is for the circle to remain stationary and the hammer to rotate around it.
  2. Although the hammer rotates around the circle, its local rotation stays the same (i.e aligned completely vertically). What I actually want is for the hammer to be at a perpendicular rotation to the angle the player is facing.

Another technique I tried was making the hammer a child of the circle with some offset. The idea was that when the parent player rotated, its child hammer would rotate with it. The problem with this method was that it would cause strange physics simulation problems where the player would end up “bumping into” its own child. After searching unity answers and the unity manuals I have found several resources which strongly advise against giving rigid bodies child rigid bodies.

Can someone recommend a good way to achieve the effect I am looking for using the unity 2d physics?

  1. There’s a number of ways you could handle this, but the most physics-compliant way would be to simply make the player have a substantially larger mass than the hammer. Otherwise, you’re going to have to make either the player or the hammer update manually.

  2. Hinge joints should rotate the hammer automatically (as opposed to a distance joint, which wouldn’t), so are you sure you didn’t just set fixed angle in it’s settings?