- Home /
OnCollisionEnter not called.
I have set up a simple system with a ball (with an attached rigidbody) falling by gravity onto a position locked box (which also has a rigidbody), everything is in the right layers and the physics works correctly. However onCollisionEnter is never called.
Everything has a rigidbody, nothing is marked as a trigger. Both have colliders.
Neither of the objects are kinematic.
Even if I remove constraints on the box or sphere no event is called.
All objects are in the same layer that has physics /collision detection enabled.
It is particularly bizarre as the box /sphere will react to hitting each other, the physics still works but the event is not called.
Can anyone help me work out why it may not be called?
void onCollisionEnter(Collision Col)
{
Debug.Log("hello?");
}
In a script attached to the box. It does nothing if it is attached to the sphere either.
don't worry I'm sure these things happen to everyone ;) can you tick corect answers as correct, thanks :)
Answer by InfiniBuzz · Jul 11, 2013 at 06:59 PM
the "O" in oncollisionenter needs to be uppercase
void OnCollisionEnter(Collision col)
{
Debug.Log("I'm working");
}
Your answer
Follow this Question
Related Questions
OnCollisionEnter before Physic simulations? 2 Answers
Collision Query 1 Answer
Possible Fall Damage OnCollisionEnter Won't Work! 0 Answers
OnCollisionEnter problem 3 Answers
Play animation by touching the MMD model using leapmotion. 0 Answers