character controller collision

hi at all. ;) i red unity documentation about CharacterController class and i seen that for manage collision in character controller there is only a function : OnControllerColliderHit;

problem of this function is that is called only while charactercontroller is performing a Move.

if my character controller represent a enemy that is stopped at a point and i shoot him,him doesn't catch a collision because in this moment enemy character controller doesn't performing a move.

so how to respond at collision if a character controller is stopped?

thanks a lot ;)

3 Answers

3

I think you have it wrong, but I might be wrong. Try using that function on an enemy.

But, their are multiple collision functions you can use.

Collision information is passed to Collider.OnCollisionEnter, Collider.OnCollisionStay and Collider.OnCollisionExit events. See Also: ContactPoint.

For more info about each, go here:

http://unity3d.com/support/documentation/ScriptReference/Collision.html

And you can click, they're near the top. This'll go by the collider box, I believe.

yes i know that exists also thi method but in character controller this functions are not called. infact if you go on doc of character controller class ( http://unity3d.com/support/documentation/ScriptReference/CharacterController.html ) in MessageSent there is only OnControllerColliderHit function.

i also tryed to use OnCollisionEnter in my character control but when i collide with a box or another object this function is not called.

if i use OnControllerColliderHit i see collision but i have problem that this work only if character is performing a move.

Yes, CC's only respond to Collisions If they are moving, just have it so the controller script is always moving them, just 0,0,0 for staying put, then all collisons register.