Weird Bounce Problem

Topics: User Forum
Nov 21, 2011 at 8:06 AM
Edited Nov 21, 2011 at 11:54 AM

Hi, I have been playing around with this physics engine for a few days now and have run across a snag. Whenever I drop a body onto a platform it starts spinning wildly at almost every bounce, so much in fact that it sometimes takes off and jumps away a bit. I am puzzled as to why it is doing this and I seem not to be able to figure out the problem for myself. I am thus asking you.

This is how I create the bouncing body:

//Create a body.
Body body1 = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(26), ConvertUnits.ToSimUnits(27), 1, ConvertUnits.ToSimUnits(new Vector2(500, 50)));
body1.BodyType = BodyType.Dynamic;

This is how I create the platform:

//Create a body.
Body body2 = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(937), ConvertUnits.ToSimUnits(32), 1, ConvertUnits.ToSimUnits(new Vector2(800, 700))); body2.BodyType = BodyType.Static;

And this is how I update the world simulation:

//Update the world simulator.
_World.Step(Math.Min((float)gameTime.ElapsedGameTime.TotalMilliseconds * .001f, (1f / 30f)));

I do not see anything out of order when I enable the debug view and I believe that a unit ratio of 50f, which I use, is perfectly adequate. I have also played around with some additional settings, such as CCD and IsFixedTimeStep, but to no avail. What other factors are in use that I have overlooked? Have I misunderstood the body creation process?

Any help is appreciated.