2

我一直在 XNA 中试用 farseer 3.3。对于我的一生,我无法让 DebugViewXNA 工作。

我有一个 World 对象,里面有几具尸体。身体固定在多边形模型上,所以我需要 debugviewXNA 类来为我绘制这些,但找不到如何去做。我假设我需要将顶点传递给它,但找不到如何从 World 对象访问这些顶点,我也不知道要准确调用哪个方法。我发现 farseer 3.3 的问题之一是支持似乎仅限于“查看示例”,但它们似乎并没有显示答案,谷歌告诉我我不是唯一一个有这种感觉的人。

非常感谢那些更有经验的人的任何帮助!

提前致谢

4

1 回答 1

2

您不需要传递 DebugViewXNA 任何顶点 - 它从附加到世界上的身体的夹具中获取该信息。这是我如何让它工作的:

physicsWorld = new World(GRAVITY);
physicsDebug = new DebugViewXNA(physicsWorld);
physicsDebug.LoadContent(this.GraphicsDevice, this.Content);
physicsDebug.AppendFlags(DebugViewFlags.Shape);
physicsDebug.AppendFlags(DebugViewFlags.PolygonPoints);

稍后用于绘图:

Matrix proj = Matrix.CreateOrthographicOffCenter(0f, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0f, 0f, 1f);
Matrix view = camera.GetViewMatrix(Vector2.One);
physicsDebug.RenderDebugData(ref proj, ref view);
于 2011-07-22T17:25:24.327 回答