Dynamic Transparency for Camera Obstruction: See Player Through Walls in Unreal Engine



I was trying to make the wall see-through. This is my code that works. It keeps track of all the objects that are getting hit by the sphere trace and sets the material value in a map data type with the key as the hit component and the value as the material. When the line trace does not hit the mesh, it will set the hit component material to a custom material with a 0.1 alpha. When the trace hits the mesh, the materials of all the objects are set back to their original material, and the map is clear. Current limitations are if the object has more than one material and if there are multiple objects between the camera and the character.