i tried this but it’s doing vice-versa
function OnControllerColliderHit(hit: ControllerColliderHit){
if (hit.transform.CompareTag(“Player”)){
Destroy(hit.gameObject);
}
}
help pls?
i tried this but it’s doing vice-versa
function OnControllerColliderHit(hit: ControllerColliderHit){
if (hit.transform.CompareTag(“Player”)){
Destroy(hit.gameObject);
}
}
help pls?
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.