1
\$\begingroup\$

I am making a 3D twin stick shooter in Unity and this is a question I need to have answered while I am still in early development. The map my player is in will have very tall buildings that will easily block the player from the view of the camera. There will be no way to change the camera angle to look behind the building so how do I make the building transparent when my player goes behind it?

Any help is appreciated. Thank you.

\$\endgroup\$
1
\$\begingroup\$

I suggest casting a raycast from your camera to your player. Make sure your buildings have colliders so the raycast hit info can return it. From there you can change the material/texture to something transparent to hide the building obscuring your view.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.