
[ad_1]
My raycast is ready to bypass the partitions and enemy is ready to see the participant. How am i able to make my ray to not go the partitions . I do not wish to use linecast.
Here is my code
Vector2 finalPosition = new Vector2(directionOfRay, 0);
RaycastHit2D raycastHit2D = Physics2D.Raycast(enemyEyes.rework.place, finalPosition, finalPosition.magnitude , LayerMask.GetMask("Player") );
if(raycastHit2D.collider != null )
{
if (raycastHit2D.collider.gameObject.tag=="Player")
{
Debug.Log("Hit Hit");
}
}
This code remains to be printing Hit Hit even my participant is behind the partitions and this ray is ready to bypass the partitions
[ad_2]