- Home /
how to detect collision between two character controllers?
How is this done? I have 2 controllers, one tagged 'victim' the other 'player'
In scripts attached to the player controller the following fails: (and vice versa)
This does not work:
public void OnControllerColliderHit(ControllerColliderHit hit) { if (hit.controller.gameObject.tag == "victim") { //never gets here }
if (hit.collider.tag == "victim")
{
//or here
}
}
Neither does this:
public void OnCollisionEnter(Collision collision)
{
// game logic never gets here
}
How do i detect this kind of thing?
Many thanks
Answer by OkeN · Mar 18, 2011 at 06:32 AM
Physics.RayCast(), will help you. Just see the doc.good luck
Your answer
Follow this Question
Related Questions
Help: A collider attached to the character controller of a FPS does not collide 1 Answer
Player falls through floor after 10-20 seconds and above certain resolution consistantly(Bug?) 5 Answers
Character - Collider With Scene 0 Answers
Character Controller's Collider Restricting Other Colliders 1 Answer
CharacterController Physics 1 Answer