从高度图渲染的地形的大小

发布于 2025-01-04 07:25:44 字数 338 浏览 3 评论 0原文

我对 XNA 还很陌生,所以如果我问了一个“愚蠢”的问题但我找不到答案,请原谅我。

我对从高度图渲染的地形有一个问题:我得到的地形太小,我的游戏需要更大的东西,但我想保持高度数据更新 - 所以我可以稍后检查碰撞。 (高度数据是一个二维数组,它保存每个点的高度 - 在我的程序中它被称为“dateInaltime”)。

问题是,如果我修改地形的比例,碰撞检查器将使用旧值(来自原始/小地形),因此我会得到错误的碰撞点。

我的地形类看起来像这个

如何使地形更大,同时扩展高度数据数组?

I'm quite new to XNA so excuse me if I ask a 'silly' question but I couldn't find an answer.

I have a problem with the terrain rendered from a heightmap: the terrain I get is too small, I need something larger for my game but I'd like to keep the heigh tdata updated - so I can check for collisions later. (height data being a 2 dimensional array which holds the heights of each point - in my program it's called 'dateInaltime').

The problem is that if I modify the scale of the terrain, the collision checker will use the old values (from the original/small terrain) so I'll get wrong collision points.

My terrain class looks like this.

How can I make the terrain larger but also extend the height data array?

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

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

发布评论

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

评论(1

鹿童谣 2025-01-11 07:25:44

将此部分更改

vertex[x + y * lungime].Position = new Vector3(x, dateInaltime[x, y], -y);

为:

vertex[x + y * lungime].Position = new Vector3(x, dateInaltime[x, y], -y) * new Vector3(10);

它应该按 10 的比例(或您选择的任何数字)分隔顶点。

Change this part:

vertex[x + y * lungime].Position = new Vector3(x, dateInaltime[x, y], -y);

to:

vertex[x + y * lungime].Position = new Vector3(x, dateInaltime[x, y], -y) * new Vector3(10);

It should separate the vertices by a scale of 10 (or whatever number you choose).

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