我是 Farseer 库的新手,我正在尝试使用 Farseer 制作 C# 表单应用程序。我创建了一个表单,在表单上放置了一个地板,然后我将一个矩形从表单顶部拖放到底部。块似乎下落,但它不会随着重力加速。我确信这是我没有设置的东西,但对于我的生活,我无法弄清楚,并希望有人能指出我正确的方向。
在此先感谢您的帮助,
杰夫
===============================重要代码================== ================
World world = new World(new Vector2(0.0f, 0.1f));
//Floor
Body floor = BodyFactory.CreateRectangle(world, 10000.0f, 30.0f, 100, new Vector2(0.0f, Height));
floor.BodyType = BodyType.Static;
// Block
Body Block1 = BodyFactory.CreateRectangle(world, 100.0f, 10.0f, 100, new Vector2(Width/2, 0));
Block1.BodyType = BodyType.Dynamic;
//(The step here is called when I timer goes off every .01/second)
//Step the world a 10th of a second.
world.Step((float).01f);
//(I draw the object this way)
gr.TranslateTransform(body.Position.X, body.Position.Y);
gr.RotateTransform((float)((body.Rotation *360)/(2*Math.PI)));
gr.FillRectangle(SystemBrushes.ButtonFace, -size.Width / 2.0f, -size.Height / 2.0f, size.Width, size.Height);
gr.ResetTransform();