I’ve been struggling with raycasting and making everything between the camera and a target transparent.
I found a lovely script over at unityAnswers that worked just perfect!
But I found that a regular raycast was way too thin for my purposes, so I decided to check out Unity’s SphereCastAll class.
Now, googling for any information about SphereCasting is, how should I put it? Confusing!
Thanks to this excellent bug report by The Ant Ranch I finally got confirmed that this is exactly what I was looking for.
But still I couldn’t get it to work properly… It lagged like hell and the hits were incoherent. That’s before I decided to find out what the hell Layermasks were all about.
Thanks to unityAnswers again, I found this excellent answer on the topic of Layermasks, which was the final drop that I needed to make this work as I wanted it to.
Hope this research will be of use to someone else too 🙂