Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Collision

Describes a collision.
Read time 2 minutesLast updated 4 days ago

Definition

  • Type: Class
  • Namespace: UnityEngine
  • Assembly: UnityEngine.PhysicsModule
public class Collision

Remarks

Collision information is passed to MonoBehaviour.OnCollisionEnter(Collision), MonoBehaviour.OnCollisionStay(Collision) and MonoBehaviour.OnCollisionExit(Collision) events.
Note: The contact points are in world-space.
Additional Resources: ContactPoint

Properties

Property

Description

angularVelocityThe angular velocity of the Rigidbody or ArticulationBody that belong to the collider that your Component collides with (Read Only).
articulationBodyThe ArticulationBody of the collider that your GameObject collides with (Read Only).
bodyThe Rigidbody or ArticulationBody of the collider that your Component collides with (Read Only).
colliderThe Collider we hit (Read Only).
contactCountGets the number of contacts for this collision.
contactsThe contact points generated by the physics engine. You should avoid using this as it produces memory garbage. Use Collision.GetContact or Collision.GetContacts instead.
gameObjectThe GameObject whose collider you are colliding with. (Read Only).
impulseThe total impulse applied to this contact pair to resolve the collision.
linearVelocityThe linear velocity of the Rigidbody or ArticulationBody belonging to the collider that your Component collides with (Read Only).
relativeVelocityThe relative linear velocity of the two colliding objects (Read Only).
rigidbodyThe Rigidbody we hit (Read Only). This is
null
if the object we hit is a collider with no rigidbody attached.
thisAngularVelocityThe angular velocity of the Rigidbody or ArticulationBody belonging to the collider of the Component that received the collision event (Read Only).
thisArticulationBodyThe ArticulationBody of the collider of the GameObject which received the Collision event (Read Only).
thisBodyThe Rigidbody or ArticulationBody of the collider that received the Collision event (Read Only).
thisColliderThe Collider that received the Collision event (Read Only).
thisGameObjectThe GameObject that received the Collision event (Read Only).
thisLinearVelocityThe linear velocity of the Rigidbody or ArticulationBody belonging to the collider of the Component that received the Collision event (Read Only).
thisRigidbodyThe Rigidbody of the collider of the GameObject which received the Collision event (Read Only).
thisTransformThe Transform of the GameObject that received the Collision event (Read Only).
transformThe Transform of the object we hit (Read Only).

Methods

Method

Description

GetContactGets the contact point at the specified
index
.
GetContactsRetrieves all contact points for this collision.