- Home /
 
 
               Question by 
               nerist · Oct 24, 2013 at 07:50 AM · 
                javascriptcollisionmacosxmacbook  
              
 
              function on collision enter not working.
Now this is the script I am using, no error no nothing. The problem is that when the 2 items hit, not even the debug log "hit" is coming up. OnCollisionEnter is not being called. One of the objects is a non kinematic rigidbody. Using OSX Mavericks.
  function OnCollisonEnter(col :Collision) {
     
         if(col.gameObject.tag=="paddle") {
      Debug.Log("hit");
         rigidbody.AddForce(0,100,0) ;
         playsound();
         }
     }
 
              
               Comment
              
 
               
              what about colliders, do both have some sort of a collider attached to them?
I found an i missing in the function OnCollision enter... went full retard there, sry for your time, but cheers
 
               Best Answer 
              
 
              Answer by MrYOLO · Oct 24, 2013 at 08:10 AM
Actually the function should be "OnCollisionEnter", you miss a "i". Also OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider. That means both of the collider should uncheck isTrigger. See the referencehere
Your answer