public static int GetContacts (Collider2D collider, Collider2D[] colliders);

Parameters

collider要检索其接触点的碰撞体。
colliders用于获取这些结果的 Collider2D 数组。

Returns

int 返回放置在 colliders 数组中的碰撞体数。

Description

获取与 collider 接触的所有碰撞体。

当获取接触时,应确保提供的数组足够大,能够包含您感兴趣的所有接触。该数组一般会重用,因此其大小应能够返回合理数量的接触。此函数还意味着不发生分配,因此不需要垃圾回收器进行回收。

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


public static int GetContacts (Collider2D collider, ContactPoint2D[] contacts);

Parameters

collider要检索其接触点的碰撞体。
contacts用于获取这些结果的 ContactPoint2D 数组。

Returns

int 返回放置在 contacts 数组中的接触数。

Description

获取与 collider 接触的所有接触点。

Contacts involving a Collider2D set to be a trigger will never be returned here because trigger Colliders do not have contact points.

当获取接触时,应确保提供的数组足够大,能够包含您感兴趣的所有接触。该数组一般会重用,因此其大小应能够返回合理数量的接触。此函数还意味着不发生分配,因此不需要垃圾回收器进行回收。

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


public static int GetContacts (Collider2D collider, ContactFilter2D contactFilter, ContactPoint2D[] contacts);

Parameters

collider要检索其接触点的碰撞体。
contactFilter接触筛选器,用于以不同方式筛选结果,例如按层遮罩、Z 深度或法线角度。
contacts用于获取这些结果的 ContactPoint2D 数组。

Returns

int 返回放置在 contacts 数组中的接触数。

Description

获取与 collider 接触的所有接触点,其结果按 ContactFilter2D 进行筛选。

Contacts involving a Collider2D set to be a trigger will never be returned here because trigger Colliders do not have contact points. This is true even if the contactFilter has its ContactFilter2D.useTriggers set to true.

当获取接触时,应确保提供的数组足够大,能够包含您感兴趣的所有接触。该数组一般会重用,因此其大小应能够返回合理数量的接触。此函数还意味着不发生分配,因此不需要垃圾回收器进行回收。

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


public static int GetContacts (Collider2D collider, ContactFilter2D contactFilter, Collider2D[] colliders);

Parameters

collider要检索其接触点的碰撞体。
contactFilter接触筛选器,用于以不同方式筛选结果,例如按层遮罩、Z 深度或法线角度。
colliders用于获取这些结果的 Collider2D 数组。

Returns

int 返回放置在 colliders 数组中的碰撞体数。

Description

获取与 collider 接触的所有碰撞体,其结果按 ContactFilter2D 进行筛选。

当获取接触时,应确保提供的数组足够大,能够包含您感兴趣的所有接触。该数组一般会重用,因此其大小应能够返回合理数量的接触。此函数还意味着不发生分配,因此不需要垃圾回收器进行回收。

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


public static int GetContacts (Collider2D collider1, Collider2D collider2, ContactFilter2D contactFilter, ContactPoint2D[] contacts);

Parameters

collider1用于检查是否与 collider2 接触的碰撞体。
collider2用于检查是否与 collider1 接触的碰撞体。
contactFilter接触筛选器,用于以不同方式筛选结果,例如按层遮罩、Z 深度或法线角度。
contacts用于获取这些结果的 ContactPoint2D 数组。

Returns

int 返回放置在 contacts 数组中的接触数。

Description

获取 collider1collider2 之间的接触的所有接触点,其结果按 ContactFilter2D 进行筛选。

Contacts involving a Collider2D set to be a trigger will never be returned here because trigger Colliders do not have contact points. This is true even if the contactFilter has its ContactFilter2D.useTriggers set to true.

当获取接触时,应确保提供的数组足够大,能够包含您感兴趣的所有接触。该数组一般会重用,因此其大小应能够返回合理数量的接触。此函数还意味着不发生分配,因此不需要垃圾回收器进行回收。

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


public static int GetContacts (Rigidbody2D rigidbody, ContactPoint2D[] contacts);

Parameters

rigidbody要检索其接触点的刚体。将检查附加到该刚体的所有碰撞体。
contacts用于获取这些结果的 ContactPoint2D 数组。

Returns

int 返回放置在 contacts 数组中的接触数。

Description

检索与附加到该刚体的任何碰撞体接触的所有接触点。

Contacts involving a Collider2D set to be a trigger will never be returned here because trigger Colliders do not have contact points.

当获取接触时,应确保提供的数组足够大,能够包含您感兴趣的所有接触。该数组一般会重用,因此其大小应能够返回合理数量的接触。此函数还意味着不发生分配,因此不需要垃圾回收器进行回收。

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


public static int GetContacts (Rigidbody2D rigidbody, Collider2D[] colliders);

Parameters

rigidbody要检索其接触点的刚体。将检查附加到该刚体的所有碰撞体。
colliders用于获取这些结果的 Collider2D 数组。

Returns

int 返回放置在 colliders 数组中的碰撞体数。

Description

检索与附加到该刚体的任何碰撞体接触的所有碰撞体。

当获取接触时,应确保提供的数组足够大,能够包含您感兴趣的所有接触。该数组一般会重用,因此其大小应能够返回合理数量的接触。此函数还意味着不发生分配,因此不需要垃圾回收器进行回收。

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


public static int GetContacts (Rigidbody2D rigidbody, ContactFilter2D contactFilter, ContactPoint2D[] contacts);

Parameters

rigidbody要检索其接触点的刚体。将检查附加到该刚体的所有碰撞体。
contactFilter接触筛选器,用于以不同方式筛选结果,例如按层遮罩、Z 深度或法线角度。
contacts用于获取这些结果的 ContactPoint2D 数组。

Returns

int 返回放置在 contacts 数组中的接触数。

Description

获取与附加到该刚体的任何碰撞体接触的所有接触点,其结果按 ContactFilter2D 进行筛选。

Contacts involving a Collider2D set to be a trigger will never be returned here because trigger Colliders do not have contact points. This is true even if the contactFilter has its ContactFilter2D.useTriggers set to true.

当获取接触时,应确保提供的数组足够大,能够包含您感兴趣的所有接触。该数组一般会重用,因此其大小应能够返回合理数量的接触。此函数还意味着不发生分配,因此不需要垃圾回收器进行回收。

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


public static int GetContacts (Rigidbody2D rigidbody, ContactFilter2D contactFilter, Collider2D[] colliders);

Parameters

rigidbody要检索其接触点的刚体。将检查附加到该刚体的所有碰撞体。
contactFilter接触筛选器,用于以不同方式筛选结果,例如按层遮罩、Z 深度或法线角度。
colliders用于获取这些结果的 Collider2D 数组。

Returns

int 返回放置在 colliders 数组中的碰撞体数。

Description

获取与附加到该刚体的任何碰撞体接触的所有碰撞体,其结果按 ContactFilter2D 进行筛选。

当获取接触时,应确保提供的数组足够大,能够包含您感兴趣的所有接触。该数组一般会重用,因此其大小应能够返回合理数量的接触。此函数还意味着不发生分配,因此不需要垃圾回收器进行回收。

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


Parameters

colliderThe Collider to retrieve contacts for.
collidersA list of Collider2D used to receive the results.

Returns

void Returns the number of Colliders placed in the colliders list.

Description

Retrieves all Colliders in contact with the collider.

The integer return value is the number of results written into the results list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results list does not need to be resized, and improves garbage collection performance when the query is performed frequently.

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


Parameters

colliderThe Collider to retrieve contacts for.
contactFilter接触筛选器,用于以不同方式筛选结果,例如按层遮罩、Z 深度或法线角度。
collidersA list of Collider2D used to receive the results.

Returns

void Returns the number of Colliders placed in the colliders list.

Description

Retrieves all Colliders in contact with the collider, with the results filtered by the contactFilter2D.

The integer return value is the number of results written into the results list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results list does not need to be resized, and improves garbage collection performance when the query is performed frequently.

The results can also be filtered by the contactFilter.

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


Parameters

colliderThe Collider to retrieve contacts for.
contactsA list of ContactPoint2D used to receive the results.

Returns

void Returns the number of contacts placed in the contacts list.

Description

获取与 collider 接触的所有接触点。

The integer return value is the number of results written into the results list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results list does not need to be resized, and improves garbage collection performance when the query is performed frequently.

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


Parameters

colliderThe Collider to retrieve contacts for.
contactFilter接触筛选器,用于以不同方式筛选结果,例如按层遮罩、Z 深度或法线角度。
contactsA list of ContactPoint2D used to receive the results.

Returns

void Returns the number of contacts placed in the contacts list.

Description

Retrieves all contact points in contact with the collider, with the results filtered by the contactFilter2D.

Contacts involving a Collider2D set to be a trigger will never be returned here because trigger Colliders do not have contact points. This is true even if the contactFilter has its ContactFilter2D.useTriggers set to true.

The integer return value is the number of results written into the results list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results list does not need to be resized, and improves garbage collection performance when the query is performed frequently.

The results can also be filtered by the contactFilter.

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


Parameters

collider1The Collider to check if it has contacts against collider2.
collider2The Collider to check if it has contacts against collider1.
contactFilter接触筛选器,用于以不同方式筛选结果,例如按层遮罩、Z 深度或法线角度。
contactsA list of ContactPoint2D used to receive the results.

Returns

void Returns the number of contacts placed in the contacts list.

Description

Retrieves all contact points in for contacts between with the collider1 and collider2, with the results filtered by the contactFilter2D.

Contacts involving a Collider2D set to be a trigger will never be returned here because trigger Colliders do not have contact points. This is true even if the contactFilter has its ContactFilter2D.useTriggers set to true.

The integer return value is the number of results written into the results list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results list does not need to be resized, and improves garbage collection performance when the query is performed frequently.

The results can also be filtered by the contactFilter.

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


Parameters

rigidbodyThe Rigidbody to retrieve contacts for. All Colliders attached to this Rigidbody will be checked.
collidersA list of Collider2D used to receive the results.

Returns

void Returns the number of Colliders placed in the colliders list.

Description

Retrieves all Colliders in contact with any of the Collider(s) attached to this Rigidbody.

The integer return value is the number of results written into the results list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results list does not need to be resized, and improves garbage collection performance when the query is performed frequently.

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


Parameters

rigidbodyThe Rigidbody to retrieve contacts for. All Colliders attached to this Rigidbody will be checked.
contactFilter接触筛选器,用于以不同方式筛选结果,例如按层遮罩、Z 深度或法线角度。
collidersA list of Collider2D used to receive the results.

Returns

void Returns the number of Colliders placed in the colliders list.

Description

Retrieves all Colliders in contact with any of the collider(s) attached to this Rigidbody, with the results filtered by the contactFilter2D.

The integer return value is the number of results written into the results list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results list does not need to be resized, and improves garbage collection performance when the query is performed frequently.

The results can also be filtered by the contactFilter.

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


Parameters

rigidbodyThe Rigidbody to retrieve contacts for. All Colliders attached to this Rigidbody will be checked.
contactsA list of ContactPoint2D used to receive the results.

Returns

void Returns the number of contacts placed in the contacts list.

Description

Retrieves all contact points in contact with any of the Collider(s) attached to this Rigidbody.

Contacts involving a Collider2D set to be a trigger will never be returned here because trigger Colliders do not have contact points.

The integer return value is the number of results written into the results list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results list does not need to be resized, and improves garbage collection performance when the query is performed frequently.

The results can also be filtered by the contactFilter.

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts


Parameters

rigidbodyThe Rigidbody to retrieve contacts for. All Colliders attached to this Rigidbody will be checked.
contactFilterReturns the number of contacts placed in the contacts list.
contactsA list of ContactPoint2D used to receive the results.

Returns

void Returns the number of contacts placed in the contacts list.

Description

Retrieves all Colliders in contact with any of the Collider(s) attached to this Rigidbody, with the results filtered by the contactFilter2D.

The integer return value is the number of results written into the results list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results list does not need to be resized, and improves garbage collection performance when the query is performed frequently.

The results can also be filtered by the contactFilter.

另请参阅:Collider2D.GetContactsRigidbody2D.GetContacts