Version: Unity 6.3 Beta (6000.3)
LanguageEnglish
  • C#

ContactFilter

struct in UnityEngine.LowLevelPhysics2D

/

Implemented in:UnityEngine.Physics2DModule

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.

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 Collision groups allow a certain group of objects to never collide (negative) or always collide (positive). A group index of zero has no effect. A non-zero group always overrides the category/contacts masks. The rules for two shapes coming into contact are: If either shape has a group of zero then the group is ignored and the category/contacts masks are used.If both shapes have a non-zero but different group then the category/contacts masks are used.If both shapes have an identical and positive group then they will always produce a contact.If both shapes have an identical and negative group then they will never produce a contact.

Constructors

Constructor Description
PhysicsShape.ContactFilter Create a contact filter.