Turn Wall's Invisible

Hi guys i know thats probably an already question answered before but after i search almost all threads i dont find one that clears my mind about this. Im creating a Diablo 3 type game i want the wall to turn invisible like in Diablo. I think the answer goes for using a box collider has a triger and only whne player leave the box collider the wall turn normal shade, but how can i do this? If someone can help me i appreciate.

Cheers

Anyone plz? I looking for this for more then 2 weeks and i dont find nothing usefull…

Appreciate.

I don’t know if that is the best way to do that, but you need to cast a ray from the camera to see if it collide with the wall.
Then if the raycast is touching the wall, you should change the alpha of your shader to be semi transparent.
You probably need to store the wall as a GameObject and reset the alpha value if the raycast is not touching it anymore.

There are a lot of shaders around here that allows alpha manipulation.

Don’t ask me for code, as I don’t have a scenario similar to yours.
Good luck!

1 Like

Ty m8. So if i understand i hv to create a script and attache it to camara. the script will cast a ray between camera and player and if something is in between i need turn it transparent and back to normal shader after leave it ? Theoricly i think i get it :slight_smile: lets see wt i can achive: =) Thx

Wow man. Why so complex?

Just make a wall out of a cube and then remove its MeshRenderer component. It will turn invisible, but will have collision on.

Shaders, coding… really?

That’s highly dependent on the exact effect he wants.

Does he want them fully invisible? Or just mostly transparent? If mostly transparent he will need a shader applying a material alpha component.
And does he want them to pop in and out of visibility or to fade over time? If fading over time he will need a shader applying an alpha component interpolated over time.

Invisible walls have no special effects. He is explaining his problem yet he doesn’t know it’s that simple.

It’s a bad idea using Invisible walls as it affects gameplay.

Hi all. Wt i want is the diablo type of thing like when im in the other side of wall im comparation with camera i can see near the wall in other side so turn alpha 0 and when im away back to normal texture… Ty for the help

I think about that… but the only way i find to counter that is not puting any kind of chests or other things near wall so i cant see them… but i will make some tests when i figure this out and after that i will choose the better performance…

You can make a wall out of 3D models (wrecked cars, debris etc) and has one big invisible wall. It’s pretty reasonable.

Well,

Like bryce said, it’s really up to you and on the quality you want to achieve.
Popping in and out stuff is not so nice in my opinion.
Having a fade in / out effect adds more polish to the effect. I think you even have complete script for the fade in / out on objects, so you could even use that as a reference.

I don’t really want a debate on what is high quality or not. Honestly doing what I proposed is not that hard if you know a little bit of coding (a lot of the information is on the forum).

And elmar, I don’t think you understood the point. The point is to have the wall invisible or semi-transparent when the player approaches it. It is something that has been used over and over and doesn’t confuse the player. It helps the player move through the environment.

1 Like

Yap its true. I already made the script and works fine but now i get other problem… im using click to move player but when i click in wall(invisible) it assume the wall and not the floor loool. So player cant go to that spot antway :S i think i will keep wall visible all the time at least player dont try go there… Or maybe i get some isues in my clicktomove script… Anyway ty for ur information and ur point :wink:

Are you using navmesh to move your player?

No… Right now just click to move without navmesh. I need implement it even for enemies too… But im not familiarized with it at 100% yet…

If youre using unity pro:

Once you figure out how to decide when you want to make a wall invisible (using the raycast method posted above or whatever you choose), you can apply the following shader. It will make your object seethrough but retain any shadow casting the object has.

    Shader "Transparent/InvisibleShadowCaster"
    {
    Subshader
    {
    UsePass "VertexLit/SHADOWCOLLECTOR"
    UsePass "VertexLit/SHADOWCASTER"
    }
    
    Fallback off
    }

Found this shader on unity answers. Having an Invisible Object that Casts Realtime Shadows. - Questions & Answers - Unity Discussions

1 Like

Your click move most likely fires a ray to get the position of the click… put your walls on a seperate layer and have your click move ignore that layer

I figure it out ty guys…

If you’re looking for a more complex solution, check See-through system. It’s shader-independent, so no material changes required, and use depth buffer instead of raycasting, resulting in very high precision.

ty m8