I am trying to get a Spherecast to let me know if it hits an object on X Layermask but for some reason it doesn’t seem to yield any result.
As far as I can tell my syntax is correct so I am really struggling as to why it wont work:
RaycastHit hit;
if (Physics.SphereCast(offSetPosition, sphereRadius, aiController.transform.forward, out hit, rayDistance, layerMask.value))
{
Debug.Log(hit.transform.name);
}
The offset position is just the aiController’s(the object shooting the sphere) position with the y position modified to be out of the ground.
Any assistance would be helpful!