Collider question

I created a script that opens a door if you collide with it and press the "o"key. But the result was not like most games where you get near the door and press the key to open it. In my game I need to keep pressing the “w” to go forward and press the “a” at the same time. I tried to increase the area of collision and enable the “trigger” because I figured if I was inside the area of ​​impact would not be necessary to be more pressing key “w”, but it did not. any help? Thanks

Sourcecode?

function OnControllerColliderHit (hit : ControllerColliderHit) {
	if (hit.gameObject.tag == "door"  Input.GetKeyDown("o")) {
		var newobj : GameObject;
		newobj = GameObject.Find("build01");
		newobj.animation.Play("open");
	}
}

or you can do a short raycast when you press o to see if you are looking at a door and within a meter of it

I think you need to change OnColliderHit for OnColliderStay

The way I understand this…
If you have a ball when
the ball bounces Unity understands as many hits as the ball touches the ground
but if the ball is sitting still on the ground Unity takes only one hit of the ball with the floor

Thanks for the answers. I beleive that the raycast is the better solution.

Another question about collision: I created an animation of a stone falling from a hill. Should I use OnControllerColliderHit function to detect when it collides with the player? It would be virtually the same script that I posted above, but adjusted for this situation? How do I do to identify the player when the collision happens? Thanks.