- Home /
how can My Player (with a character Controller) be destroyed if it hits a Box Collider??
i tried this but it's doing vice-versa :(
function OnControllerColliderHit(hit: ControllerColliderHit){ if (hit.transform.CompareTag("Player")){ Destroy(hit.gameObject); } }
help pls?:(
Answer by robertbu · Aug 20, 2014 at 03:28 AM
OnControllerColliderHit() must be on the object with the CharacterController scirpt. So you have to do it in reverse, and have a script on the CC that check the object it collides with. So the script above should work if you 1) place in the CC and 2) check for a tag on the object with the box collider.
Your answer
Follow this Question
Related Questions
Raycast on ball game 2 Answers
Rigidbodies won't collide if mass difference is too high 0 Answers
Detailed terrain mesh collision 1 Answer
Problem with custom raycast2D collision detection system. 1 Answer
Character Controller meets Rigidbody 1 Answer