Version: Unity 6.4 Alpha (6000.4)
LanguageEnglish
  • C#

Physics2D.GetContactColliders

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

Declaration

public static ColliderArray2D GetContactColliders(Collider2D collider, ContactFilter2D contactFilter, Unity.Collections.Allocator allocator);

Parameters

Parameter Description
collider The Collider to retrieve contacts for.
contactFilter The contact filter used to filter the results differently, such as by layer mask, Z depth, or normal angle.
allocator The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

ColliderArray2D A collection of Collider2D containing the results. The collection does not allocate any managed memory but must be disposed of.

Description

Retrieves all colliders in contact with this Collider, with the results filtered by the contactFilter.


Declaration

public static ColliderArray2D GetContactColliders(Rigidbody2D rigidbody, ContactFilter2D contactFilter, Unity.Collections.Allocator allocator);

Parameters

Parameter Description
rigidbody The Rigidbody to retrieve contacts for. All Colliders attached to this Rigidbody will be checked.
contactFilter The contact filter used to filter the results differently, such as by layer mask, Z depth, or normal angle.
allocator The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

ColliderArray2D A collection of Collider2D containing the results. The collection does not allocate any managed memory but must be disposed of.

Description

Retrieves all colliders in contact with this Rigidbody, with the results filtered by the contactFilter.