gpt4 book ai didi

c# - Farseer 3.3 DebugViewXNA - 连接起来

转载 作者:太空宇宙 更新时间:2023-11-03 11:34:22 24 4
gpt4 key购买 nike

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

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

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

提前致谢

最佳答案

您不需要向 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);

关于c# - Farseer 3.3 DebugViewXNA - 连接起来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6787181/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com