- Home /
collisions between character controllers
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
Related (but with attached triggers): http://answers.unity3d.com/questions/32870/how-can-i-make-an-enemy-hurt-the-player
Can you post the script that contains the collision?
Answer by bisciasia · Apr 01, 2011 at 01:38 PM
yes ;)
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 :(
Your answer
![](https://koobas.hobune.stream/wayback/20220613120141im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
collision detection not working? 1 Answer
Character is not grounding. 2 Answers
What's a good way to find the ground normal? 1 Answer
Simple AI and Animation 2 Answers