- Home /
OnCollisionEnter doesn't work - C#
This simple line of code won't work. I need this to work so the rest of my project can work.
void OnCollisionEnter(Collision coll)
{
Debug.Log("hit something");
}
Exactly what are you trying to do? Also if this is on your character controller the other object you are trying to "hit" must also have a collider on it.
Do you have a rigidbody on your gameobject? You can set it to kinematic since you're using a CharacterController.
Answer by Loius · May 15, 2013 at 12:19 AM
you want this one instead: http://docs.unity3d.com/Documentation/ScriptReference/CharacterController.OnControllerColliderHit.html?from=ControllerColliderHit
How would I use this to make a bool go off? For instance:
If player has a key & player hits door: door = true; door gets destroyed
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Simple collision? 2 Answers
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer