This project has moved. For the latest updates, please go here.

Fence post joint

Topics: Developer Forum
May 22, 2013 at 5:36 AM

I am looking for the correct type of joint to simulate a fence rotating around a post in birds-eye perspective. Closest thing I have is a singular fence rotating on its point of origin, code below.
public void AddFence(float x, float y)
            // Create a fence
            Fixture Temp = FixtureFactory.CreateRectangle(_world, obstacle.Width / _pixelsPerMeter, obstacle.Height / _pixelsPerMeter, 1);
            Temp.Body.Mass = 100;
            Temp.Body.LocalCenter = new Vector2(300, 0);
            Temp.Body.Position = new Vector2(x * 2.5f, y * 2.5f);
            Temp.Body.Rotation = 90 * ((float)Math.PI / 180);
            Temp.Body.BodyType = BodyType.Dynamic;
            Temp.Body.LocalCenter = new Vector2(10, 0);
            Temp.Body.FixedRotation = false;
            JointFactory.CreateAngleJoint(_world, _obstacleFixtures[0].Body,LevelBodies[10,10].Body);
public override void Update()
_obstacleFixtures[0].Body.Position = LevelBodies[9, 10].Body.Position + new Vector2(0, -obstacle.Width / 2 / _pixelsPerMeter);
There's a fair chance that I just don't know the exact type of joint needed
May 22, 2013 at 6:06 AM
Disregard, fixed it...
JointFactory.CreateFixedRevoluteJoint(_world, _obstacleFixtures[0].Body, _obstacleFixtures[0].Body.LocalCenter - new Vector2(obstacle.Width/2/_pixelsPerMeter,0), new Vector2(20,20));
Will leave this up for anyone else who needs it.

Also, I have shoehorned a few different systems into my game. Farseer Physics and tIDE. There's a couple of layers that do different things (map background, spawn entities). If anyone wants to have a look at the current progress and to see how I implemented the fence joint, visit

Please don't hesitate to ask if you want help marrying up Farseer and tIDE with XNA.