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;
public override void Update()
_obstacleFixtures.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
Disregard, fixed it...
JointFactory.CreateFixedRevoluteJoint(_world, _obstacleFixtures.Body, _obstacleFixtures.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.