if (Physics.Raycast(player.transform.position, forward * range, out hitInfo))
{
Enemy enemy = hitInfo.transform.GetComponent();
if (enemy != null)
{
enemy.TakeDamage(damage);
Debug.Log(“Enemy took " + damage + " damage points”);
Debug.DrawRay(player.transform.position, forward * range, Color.red);
}
I am having a hard time with raycasts. The problem is my raycast doesn’t seem to be increasing in length when I up the range variable.
Thanks in advance
Br Andreas