Hi everyone, I’ve a scene where there is a trasparent glass, what I want to do is: choose some objects and hide them if you’re watching them through the glass. How can I achive that?
Use two line traces and cast the first one from the player’s location to one of the corners of the glass and cast the second from the player’s location to the other corner. Then, detect if their hits are on the glass seperately by creating a new trace channel just for the glass, or if you have multiple glasses just give them actor tags (make sure you give them actor tags) and check if a glass is what’s got hit using the “Actor Has Tag” node. Once you detect the field of view of the player through the glass from any given angle, detect if an actor is inside the area between them by getting it’s world location and using some math. But if that’s too complex, you can simply cast two seperate line traces that’s perpendicular to the actor’s front vector, one being on the right and the other on the left, check if they both hit those two line traces respectively which are casted from the player and finally hide the actor using the “Set Actor Hidden in Game” node. Hope this helps!
Btw this approach should work universally but if you already have a restricted scene, you can use simpler methods such as using hit boxes to determine if the player’s in the area that it can view through the glass and then hide the actors behind it
No it should’t work for me because I have big obects and I have to hide only the parts behind the glass.
This is the effect I want
Make the “glass” contain a dynamic image behind it then
What it means?
one more thing, the glass is in movement
In that case, idk how but research on is there a way to place a camera on the “glass” that’s pointed behind it, and stream the image on it’s surface