Tilemap 中非完整图块的碰撞检测

发布于 2024-10-14 22:36:51 字数 204 浏览 2 评论 0原文

如果从图块集创建图块地图并且存在未完全填满的图块/方块,那么如何使这些半填充的图块能够检测到碰撞?

选择一个正方形区域并将其设置为例如碰撞是很容易的

但是如何处理填充半个图块的圆形边缘或刚刚进入图块的三角形形状?

或者是否创建一整层并将其设置为碰撞,以便不需要检查图块是否发生碰撞?

然而,如何检测碰撞层呢?

谢谢

If one creates a tile map from a tileset and there are tiles/squares that are not completely full, how Does on make these half filled tiles able to detect collision?

Its easy to select an area that is square and set it to e.g. collision yes

But how does one handle rounded edges that fill half a tile or a triangular shape that is just entering a tile?

Or does one create an entire layer and set it to collision yes that that tiles dont need to be check for collision?

Still, how does one detect the layer for collisions?

Thanks

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

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

发布评论

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

评论(1

脸赞 2024-10-21 22:36:51

基于图块的系统的整体思想是,东西填充整个图块。当然,您可以对图块应用普通的碰撞检测方法,或者在每个图块的基础上应用它们。

有些游戏允许建筑物填满整个瓷砖,但仍然有单位穿过瓷砖。这通常是通过取 4 个角点(以及边中心的 4 个点)并检查其中一些点之间的线是否与任何物体发生碰撞来完成的,如果是这样,则单位可以沿着这些线行进。

这通常是针对每一个可以占据一块瓷砖的建筑物进行预先计算的。

The whole idea of a tile based system is that stuff fills an entire tile. You can apply normal collision detection approaches to tiles of course, or apply them on a per tile basis.

Some games allow buildings to fill a whole tile, but still have units traverse tiles. This is often done by taking the 4 corner points (and 4 points at the center of the sides) and checking if a line between a few of these points doesn't collide with anything, if that is true then units can travel these lines.

This is often pre-computed for every building that can occupy a tile.

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