- Home /
Enemy can't find weapon collider
So my code I'm sure is set up correctly but I think I need another pair of eyes. I have it so if the player or the player's weapon hits the enemy, it is to take damage. I know the collison boxes are hitting each other but it only takes damage if I ram the player into the enemy since the only attack is with his weapon.
function OnTriggerExit(collider:Collider) {
if (collider.tag == "Player" || collider.tag == "Weapon"){
if(curHealth == 0) {
isDead = true;
}
else {
curHealth -= 10;
isAttacked = true;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Null reference exception on raycast collider hit? Targetter vs Moving Player 1 Answer
How can I detect if box is touching a tag named weapon? 1 Answer
Decreasing Player Health On Collision with Enemy 2 Answers
How to handle multiple colliders for one enemy and bullet. 3 Answers
Lose health on collision 1 Answer