Rotation Problem

Topics: User Forum
May 24, 2011 at 3:50 AM

I've been working on a puzzle game using Farseer for a couple months and everything has been going great. I noticed that some dynamic bodies have suddenly stopped rotating, and I can't figure out why.

My goal is to have a central body, I'll call it the magnet, attract several hexagons towards it with a constant force. These hexagons randomly spawn radially around the magnet, and should eventually arrange themselves into a neat tiled pattern due to the magnet's force. The problem is, they never change rotation, so you get strange situations like a hexagon standing on one point, etc.

The only body which rotates is the magnet -- it is attached to a revolute joint so it won't translate. This isn't possible for the hexagons, since they have to move around freely. I have tried making all bodies circular and adjusting friction values, but neither seem to affect anything. I've made sure I'm not accidentally setting Body.FixedRotation to true, and the only time I manually set rotation is when the body is created and before enabling it.

Any help is greatly appreciated. Thanks for all your hard work.

May 24, 2011 at 7:58 PM

I fixed the problem. I was not setting up the inertia correctly. It was stuck at a value of 0.

May 24, 2011 at 8:02 PM

I had this exact same problem yesterday, same solution. It was weird, because I was sure that I never had inertia set to begin with. Hmm