Hello! I was just making a little FPS game and look what i found! If i try to shoot JUST over the head of my enemy, they still receive damage! Please help.
P.S. photo and script attached ::
if (Input.GetButtonUp ("Fire1"))
{
if (Physics.Raycast(pos1, dir, out shot, 20f))
{ selectedTarget = shot.collider.gameObject;
enemyhp = selectedTarget.GetComponent<enemyHp> ();
enemyhp.curHealth = enemyhp.curHealth - 10;
if (enemyhp.curHealth <= 0) {
Destroy(selectedTarget);
selectedTarget = null;
}
}
}