hi guys ;) i have a problem with collisions between character controllers. i have 2 character controllers : one is stopped in a point e another is firts person player that i move. when one character hit other, nobody of characters see the collision event. i try to override both OnCollisionEnter that OnControllerColliderHit but nothing. some idea for resolve or avoid this problem? ;) thanks
1 Answer
1yes ;)
void Update () {
transform.Rotate(0,rotateSpeed*Input.GetAxis("Horizontal"),0);
var forward = transform.TransformDirection(Vector3.forward);
var curspeed = speed * Input.GetAxis("Vertical");
character.SimpleMove(curspeed*forward);
}
void OnControllerColliderHit(ControllerColliderHit hit){
if(hit.gameObject.name!="Plane")
print("works hit");
} void OnCollisionEnter(Collision collision){ if(collision.gameObject.name != "Plane") print("works"); }
this code is attached at my first person player that has a character controller attached. in my game there is also another object that is the enemy that has same events and a character controller attached.but when i hit other character controller,events are not sent :(
Related (but with attached triggers): http://answers.unity3d.com/questions/32870/how-can-i-make-an-enemy-hurt-the-player
– StatementCan you post the script that contains the collision?
– anon93868717