“折断”所需的帮助XNA 中的 3D 模型到 3D 地形网格

发布于 2024-10-18 05:29:00 字数 374 浏览 1 评论 0原文

我试图将模型的高度限制为其移动的网格的高度。我研究这个问题已经有一段时间了,如果我使用高度图来生成地形,似乎有很多方法可以解决这个问题,只需返回并检查网格体的边界球与存储期间存储的顶点数据的碰撞即可。网格生成,但我喜欢将网格导入为 .x 文件的想法。

我一直在尝试创建一个自定义内容处理器来将地形的顶点数据(编辑:)保存为(编辑:)地形上的标签> 模型,但它似乎比我想象的要复杂得多。我刚刚从微软获得了三角形选择教程,这似乎是一个可能的解决方案,但是还有其他更简单的方法吗?

我试图在可能随机生成的网格(地形)上移动没有变化的网格(例如球)。有什么想法,或者我应该忍受三角形选取示例强加给我的学习曲线吗?

谢谢。

I'm trying to restrict the height of a model to the height of the mesh on which it's moving. I have been looking into this issue for a short while and it seems like there are plenty of ways to solve the problem if I used a heightmap to generate the terrain, simply going back and checking the mesh's boundingsphere for collision with the vertex data stored during the mesh generation, but I like the idea of importing the mesh as a .x file.

I've been trying to wrap my head around creating a custom content processor to save the vertex data (edit:) of the terrain as a tag on the (edit:) terrain model, but it seems quite a deal more complex than I would have thought. I've just gotten a hold of the triangle picking tutorial from Microsoft, and it seems like a possible solution, but is there another, simpler way?

I'm trying to move a mesh with no variation (a ball, for instance) over a potentially randomly generated mesh (terrain). Any ideas, or should I just suffer through the learning curve imposed on me by the triangle picking example?

Thanks.

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

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

发布评论

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

评论(1

呆头 2024-10-25 05:29:00

简单的答案(这是大多数人生成地形的方法)是让模型包含在边界框中,并让模型的参考点位于边界框底部的中间。当您捕捉到地形时,您会在所需的 x,y 点处找到 z 值,并将该 z 值设置为模型的 z 值。

现在,这会导致您的地形有时看起来像这样:在此处输入图像描述

但这通常没问题。它适用于大多数情况下的捕捉,然后您可以在显示的情况下根据需要手动调整。

The simple answer (which is what most do to generate their terrains) is to have your model contains in a bounding box, and let the model's reference point be the middle of the bottom of the bounding box. When you snap to terrain, you find the z value at the desired x,y point, and set that z value as the model's z value.

Now this will cause your terrain to sometimes look like this:enter image description here

But that's usually okay. It works for the snapping in most cases, then you manually tweak if you need to in the cases where it shows.

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