Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Collision

Namespace: UnityEngine

Description

Describes collision.

Collision information is passed to Collider.OnCollisionEnter, Collider.OnCollisionStay and Collider.OnCollisionExit events. See Also: ContactPoint.

Variables

colliderThe Collider we hit (Read Only).
contactsThe contact points generated by the physics engine.
gameObjectThe GameObject whose collider we are colliding 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.
transformThe Transform of the object we hit (Read Only).