Skip to main content
Post Closed as "Duplicate" by DMGregory, Philipp, CommunityBot
added 4 characters in body
Source Link

I am willing to raycast specific layer and ignore other layers no matters its colider is above to my navPoint layer objectraycast specific layer and ignore other layers no matters its colider is above to my navPoint layer object?

 int specificLayerMask = LayerMask.GetMask("NavPoint");//raycast only this layer ignore others

        if (Physics.Raycast(raycastObject.transform.position, fwd, out objectHit, specificLayerMask))//50
        {}

the above code raycasting to navpoint layer but unable to bypass other layers colliders. is there any way available to ignore all other collider and raycast to desired layer only no matter colliders are behind any other collider

I am willing to raycast specific layer and ignore other layers no matters its colider is above to my navPoint layer object?

 int specificLayerMask = LayerMask.GetMask("NavPoint");//raycast only this layer ignore others

        if (Physics.Raycast(raycastObject.transform.position, fwd, out objectHit, specificLayerMask))//50
        {}

the above code raycasting to navpoint layer but unable to bypass other layers colliders. is there any way available to ignore all other collider and raycast to desired layer only no matter colliders are behind any other collider

I am willing to raycast specific layer and ignore other layers no matters its colider is above to my navPoint layer object?

 int specificLayerMask = LayerMask.GetMask("NavPoint");//raycast only this layer ignore others

        if (Physics.Raycast(raycastObject.transform.position, fwd, out objectHit, specificLayerMask))//50
        {}

the above code raycasting to navpoint layer but unable to bypass other layers colliders. is there any way available to ignore all other collider and raycast to desired layer only no matter colliders are behind any other collider

Source Link

Raycast only specific layer and ignore other collider

I am willing to raycast specific layer and ignore other layers no matters its colider is above to my navPoint layer object?

 int specificLayerMask = LayerMask.GetMask("NavPoint");//raycast only this layer ignore others

        if (Physics.Raycast(raycastObject.transform.position, fwd, out objectHit, specificLayerMask))//50
        {}

the above code raycasting to navpoint layer but unable to bypass other layers colliders. is there any way available to ignore all other collider and raycast to desired layer only no matter colliders are behind any other collider