Problem with Colliders

Hi there.

I was working on my own project and I really want the FPC (First person controller) to interact with objects with the way I thought of. The concept uses the “OnCollisionEnter/OnCollisionStay/OnCollisionExit” functions.

Take a look at the code:

" void OnCollisionEnter(Collision collision)
{
Debug.Log (“Touched the box”);
}

void OnCollisionStay(Collision collision){
	Debug.Log ("Still touching the box");
}

void OnCollisionExit(Collision collision){
	Debug.Log ("Left the box area");
} "

This is attached to the FPC but I’m wondering why I’m not getting any results. Yes they both have colliders of course, and the FPC has a rigidbody. The problem definitely is the FPC because I tested the script with other objects. I placed a sphere above a slightly tilted cube (both with colliders and the sphere with the rigidbody) and when the sphere fell, the script ran perfectly so I’m sure I can safely isolate the problem being the FPC. What am I doing wrong?

Any bit of help much appreciated.

Character Controller?

Try this

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnControllerColliderHit.html