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


Topics: Developer Forum
Jul 9, 2010 at 10:44 AM
Edited Jul 9, 2010 at 1:37 PM
Hi there. I'm using Farseer 2.1.3. I'm trying to create a windmill with 4 surrounding baskets that the player will be able to go inside. The baskets at the moment have been laid out like |__|. I am using a body for each basket and 3 geoms for each side of the basket. I would like the baskets to move a little when pressure by the player is applied, so they will shake when the player jumps into the basket, therefore the baskets cannot be made static. Obviously the windmill and its baskets will need to rotate. I have looked at the agent class in the Farseer 2.1.3 demos, which is structured with 1 body and 7 geoms (5 for circles, 2 for rectangles), which has a similar layout to what I want. My dilemma is a little more complicated since I am using 3 geoms for each basket, which is why I thought having a body for each basket would be the best solution. If anyone has a recommendation on how to tackle this problem, please enlighten me. Thanks in advance. :-)
Jul 9, 2010 at 11:43 AM
Edited Jul 9, 2010 at 11:45 AM

Try attaching the basket body to the windmill using a revolute joint and an angle joint. Give the joints a high softness factor so that they wobble. You will have to experiment until you find the right value.

You shouldn't have to worry about the geoms at all, I think, and the baskets will automatically turn along with the windmill. Just make sure they don't collide.

Jul 9, 2010 at 1:53 PM
Edited Jul 9, 2010 at 5:01 PM
Thanks for the post robertdodd.

Its close to what is wanted but not fully there yet. The following code is used in the windmill's constructor.

JointFactory.Instance.CreateRevoluteJoint(level.PhysicsSimulator, windmill.body, baskets[0].Body, windmill.position); JointFactory.Instance.CreateAngleJoint(level.PhysicsSimulator, windmill.body, baskets[0].Body, 0f, 0.2f);

In the Update function the body of the windmill is updated.

body.Rotation += (float)gameTime.ElapsedGameTime.TotalSeconds;

Currently the windmill spins clockwise, whereas the basket spins counter-clockwise.

In addition to this, whilst the basket rotates around the windmill's center, it still rotates locally. I do not want the basket to rotate locally, but just to rotate around the windmill's center. I have tried to use a FixedAngleJoint, but this has stopped the basket from moving all together.

Also when posting in these forums, I had to put HTML tags in to create a blank line, since whenever I type Enter on the keyboard it doesn't actually post a blank new line in the post itself, but on the Edit view it shows new lines. Am I doing something wrong?