且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

根据对象标签Unity 2d禁用或启用碰撞

更新时间:2021-08-12 22:35:18

除了通过标签执行此操作外,您可能还想

Instead of doing this via tags, you might want to have a look at layers.

通过将不同的对象分配给不同的图层,可以将它们设置为彼此碰撞或忽略任何潜在的碰撞.您可以在以下位置实现

By assigning different objects to different layers, you can set them to either collide with each other, or ignore any potential collisions. You can achieve this at

编辑->项目设置->物理

Edit->Project Settings->Physics

您可以在其中编辑图层碰撞矩阵,以启用或禁用图层元素之间的碰撞.

where you can edit the layer collision matrix, to enable or disable collisions between layer elements.