Farseer 3.3 DebugViewXNA - 连接起来

发布于 2024-11-25 08:39:49 字数 297 浏览 2 评论 0原文

我一直在 XNA 中试用 Farseer 3.3。我一生都无法让 DebugViewXNA 工作。

我有一个世界对象,里面有几个实体。主体固定为多边形模型,因此我需要 debugviewXNA 类来为我绘制这些模型,但无法找到如何做到这一点。我假设我需要向它传递顶点,但无法找到如何从 World 对象访问这些顶点,也不知道到底要调用哪个方法。我发现 Farseer 3.3 的问题之一是支持似乎仅限于“查看示例”,但它们似乎没有显示答案,谷歌告诉我我不是唯一有这种感觉的人。

如果有经验丰富的人提供帮助,我们将非常感激!

提前致谢

I have been trialling farseer 3.3 in XNA. For the life of me I cannot get DebugViewXNA to work.

I have a World object with a couple of bodies in there. The bodies are fixed to polygonal models, so I need the debugviewXNA class to draw these for me but cant find how to do it. I assume I need to pass it the vertices but cannot find how to access these from the World object nor do I understand which method to call exactly. One of the issues I find with farseer 3.3 is the support seems limited to "look at the examples" but they just dont seem to show the answers, google tells me I am not the only one feeling this way.

Any help from those more experienced would be very much appreciated!

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹤仙姿 2024-12-02 08:39:49

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

You shouldn't need to pass DebugViewXNA any vertices - it grabs that info from the Fixtures attached to the Bodies in the World. Here's how I got it working:

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

And later on for drawing:

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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文