Search Unity

OnCollisionEnter vs OnControllerColliderHit

Discussion in 'Scripting' started by asterix, Sep 7, 2009.

  1. asterix

    asterix

    Joined:
    Aug 1, 2009
    Posts:
    245
    What is the difference between:
    OnCollisionEnter vs OnControllerColliderHit
    and what are their respective use example in a game?

    Thanks
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    OnCollisionEnter detects when contact has occurred between any colliders. OnControllerColliderHit gives information specific to the CharacterController class - this is used for game characters which need plausible collision/contact with objects, but whose physical behaviour is not otherwise very realistic.