Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

ContactFilter

struct in Unity.U2D.Physics

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A contact filter is used to control what contacts are created when intersecting other shapes. A contact filter contains a filter with the addition of a group index allowing overrides to the filter.

See ContactFilterMode.

Static Properties

Property Description
DefaultCategories The default categories used.
DefaultContacts The default contacts used.
defaultFilter Get a default contact filter that contacts everything.
Everything Get a contact filter that is all categories and contacts everything.

Properties

Property Description
categories The categories this object is in. Usually you would only set one bit but multiple are allowed.
contacts The categories this object will produce contacts with.
groupIndex The group which the contact filter uses to determine if the categories and contact masks are used. See ContactFilterGroupMode for more information.

Constructors

Constructor Description
PhysicsShape.ContactFilter Create a contact filter. See ContactFilterMode.

Public Methods

Method Description
CanContact Will this contact filter produce a contact with the specified contact filter. The term "contact" here means that if these filters were used on two PhysicsShape, would a contact be produced.