Version: 2023.2

Collider.layerOverridePriority

切换到手册
public int layerOverridePriority ;

描述

A decision priority assigned to this Collider used when there is a conflicting decision on whether a Collider can contact another Collider.

The Layer Collision Matrix defines which layers can contact other layers. Additionally, you can include and exclude layers per Collider or for all Colliders attached to a specific Rigidbody or ArticulationBody. Any contact involves two different Collider instances. Unfortunately this can result in one Collider deciding that it should contact the other Collider, but the other Collider deciding it shouldn't. There are rules to decide how these situations are handled.

The rules for making a decision between two Colliders, referred to here as A and B, are made in the following order: If both A and B make the same decision then use that decision. If only A or B are using a layer include or exclude override, then use the decision for A or B that has the include or exclude override specified. If both A and B are using a layer include or exclude override, then use the decision from A or B that has the higher Collider.layerOverridePriority. If A and B have the same Collider.layerOverridePriority, then the decision will be to not create a contact. See Also: Collider.includeLayers, Collider.excludeLayers, Rigidbody.includeLayers, Rigidbody.excludeLayers, ArticulationBody.includeLayers, ArticulationBody.excludeLayers.

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