Version: 2023.1
언어: 한국어

Collision2D

class in UnityEngine

매뉴얼로 전환

설명

Collision details returned by 2D physics callback functions.

The collisions details are returned by MonoBehaviour.OnCollisionEnter2D, MonoBehaviour.OnCollisionStay2D and MonoBehaviour.OnCollisionExit2D callbacks. It details which Collider2D and Rigidbody2D pairs are involved in the collision as well as contact points where the Collider2D meet.

변수

colliderThe incoming Collider2D involved in the collision with the otherCollider.
contactCountGets the number of contacts for this collision.
contactsThe specific points of contact with the incoming Collider2D. You should avoid using this as it produces memory garbage. Use GetContact or GetContacts instead.
enabledIndicates whether the collision response or reaction is enabled or disabled.
gameObjectThe incoming GameObject involved in the collision.
otherColliderThe other Collider2D involved in the collision with the collider.
otherRigidbodyThe other Rigidbody2D involved in the collision with the rigidbody.
relativeVelocityThe relative linear velocity of the two colliding objects (Read Only).
rigidbodyThe incoming Rigidbody2D involved in the collision with the otherRigidbody.
transformThe Transform of the incoming object involved in the collision.

Public 함수

GetContactGets the contact point at the specified index.
GetContactsRetrieves all contact points for contacts between collider and otherCollider.