Raycast Not Detecting Hit
I have an enemy and i want it to shoot a raycast at the player and detect the hit.
RaycastHit hit;
if (Physics.Raycast(transform.position, target.transform.position, out hit, Mathf.Infinity))
{
print("Enemy Hitting: " + hit.collider.name + " ON " + hit.collider.transform.root.name);
}
I'n not getting any print statements. Very confused. I've checked that target.transform.position is correct and there is a collider there.
Comment