统一 - 根据物理形状检测特定瓷砖的碰撞
我已经设置了游戏来检测与TileMapCollider2D的碰撞。我所有的瓷砖都有自己的自定义物理形状(半细胞,三角形等),到目前为止,该部分有效。
现在,我想有能力不仅检测出碰撞,还可以检测到碰撞的瓷砖。我能够找到的大多数解决方案都涉及通过tilemap.worldtocell(worldpos)
找到碰撞的单元格坐标,这将与方形瓷砖一起使用。但是,由于我的物理形状非常不规则(有时比单个细胞大得多),因此我需要可以根据物理形状本身检测到的东西,而瓷砖被击中。
如果使用TileMapCollider2D无法做到这一点,那么我可能必须使用多个墙面找到解决方案。关于完成我想要的最佳方法的任何想法吗?提前致谢!
I have my game set up to detect collisions with a TilemapCollider2D. All of my tiles have their own custom physics shapes (half cells, triangles, etc.), and so far this part works.
Now, I want to have the ability to not only detect a collision, but also detect which tile that collision was with. Most solutions I've been able to find involve finding the cell coordinates of the collision, through tileMap.WorldToCell(worldPos)
, which would work great with square tiles. However, since my physics shapes are VERY irregular (sometimes much larger than a single cell), I need something that can detect based on the physics shape itself which tile was hit.
If this isn't possible with the TilemapCollider2D then I may have to find a solution using multiple colliders. Any idea of the best way to accomplish what I'm looking for? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论