This project has moved and is read-only. For the latest updates, please go here.

How to Make a Hammer (with a fixed origin)

Topics: User Forum
Sep 3, 2013 at 3:08 PM
I am trying to make a hammer that swings from a single static point.

I created a Rectangle Fixture as the hammer head and a Static Body to be the bottom of the handle. Then I created a distance joint between the two. When I want to rotate the hammer I apply a force to the hammer read and it rotates nicely.

There is one major problem, the hammer head rotates freely, and doesn't stay in line with the handle/origin. At first I thought that I could just set the rotation manually every update, but then the head rotates and acts funny when it impacts with stuff.

I tried setting the hammer head to have fixed rotation but that just makes it "spazzy". I also tried using a weld joint but then the hammer head wont rotate anymore.

Any help would be appreciated, I will post a demo if it will help.
Sep 4, 2013 at 3:40 AM
I realized there was no reason that a revolute joint shouldn't work and it was just a matter of getting the anchor point to be the hammer origin. Here's what I ended up with:

FarseerPhysics.Factories.JointFactory.CreateRevoluteJoint(World, hammerBody, hammerOrigin, Vector2.Zero);