Raycast intersecting with hidden object

is there any way, raycast only works for visible objects in scene.

Unfortunately, that’s not true. The following live example demonstrates that also invisible objects are honored by raycasting.

I know. but is there any method in which only visible objects are honored by raycasting

Yes, you can use Raycaster.layers for this.

2 Likes

thanks for your quick answers.
you are best teacher for newcomers like me.
there are lot of things I learnt from you.

1 Like