In my game I have a radius that when it hits a particular layer must perform a certain action. How can I say that he must behave in other ways when he hits other layers? I wanted to avoid another “if”
public bool hasHit()
{
RaycastHit hit;
if (Physics.Raycast(this.transform.position, this.transform.right, out hit, 0.2f, current))
{
//TODO
return true;
}
else return false;
}