#use the `Linecast` method with the `out

1 messages · Page 1 of 1 (latest)

tranquil quiver
#
            if (Physics.Raycast(ray, out var hitInfo, Mathf.Infinity, enemyMask))
            {
                RaycastHit hit;
                if (Physics.Linecast(muzzle.transform.position, hitInfo.point, out hit))
                {
                    if (hit.collider.gameObject.layer == 16)
                    {
                        Debug.Log("Correct target");
                    }
                }
            }```
#

Thank you xD