Legacy Documentation: Version 5.2
Layers
Graphics Reference

Layer-Based Collision Detection.

Layer-Based collision detection is a way to make Game Objects collide with another specific Game Objects that are tied up to specific layers.

Objects Colliding with their own layer.
Objects Colliding with their own layer.

In the image above you can see 6 GameObjects, (3 planes, 3 cubes) and the “Collision Matrix” to the right that states which Objects can collide with which layer. In the example, we have set the Collision Matrix in a way that only GameObjects that belong to same layers can collide.

Setting GameObjects to detect Collisions Based on Layers.

  1. Select a layer your Game Objects will belong to

  2. Repeat 1 for each Game Object until you have finished assigning your Game Objects to the layers.

  3. Open the Physics Preference Panel by clicking on Edit->Project Settings->Physics.

  4. Select which layers on the Collision Matrix will interact with the other layers by checking them.

Layers
Graphics Reference
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961