Hiding walls using 3D Raycasting

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Coolhaha1

I’m developing a 3d rpg, and right now i’m just trying to configure basic controls.
When the player walks behind a wall or building or something, ideally I want the alpha channel of the shader material halved so it appears translucent, but I’m struggling to even hide the wall in the first place. I’d like to implement this feature because the camera zooms out and doesn’t just clip through the wall, so the player can still be seen from afar. I’m using raycasting to detect when the 3d camera is behind a wall or platform, and I know it is because I set up print commands that tell me if it’s colliding and where, and it doesn’t collide with the player because I’m using separate collision masks.
Right now, the code looks like this, but all that happens is the boolean changes and I can see output in the debugger:

extends Camera

onready var cam_raycast = $RayCast
onready var wall_And_Platform=load("res://World/WallsAndPlatforms.tscn").instance()
onready var wall_Alpha_Seethrough = false

func _ready():
	set_process(true)
func _process(delta):
	if cam_raycast.is_enabled() and cam_raycast.is_colliding():
		wall_Alpha_Seethrough = true
		print(cam_raycast.get_collision_point())
	else:
		wall_Alpha_Seethrough = false
	print(wall_Alpha_Seethrough)

func _wall_alpha_check():
	if wall_Alpha_Seethrough == true:
		wall_And_Platform.hide()
	else:
		wall_And_Platform.show()

I’m pretty sure the problem is in the “wall_And_Platform” variable, because I had code that looked like this, but wall_Alpha_Seethrough always put out “false” in the debugger:

func _process(delta):
if cam_raycast.is_enabled() and cam_raycast.is_colliding():
	var collidedWithObject = cam_raycast.get_collider()
	if collidedWithObject == wall_And_Platform:
		wall_Alpha_Seethrough = true
		print(cam_raycast.get_collision_point())
else:
	wall_Alpha_Seethrough = false
print(wall_Alpha_Seethrough)

but I’m not sure why exactly it is. The scene root is a spatial, but it didn’t work when the root was a MeshInstance either. As I mentioned before, the walls don’t physically change or disappear at all, but I know the raycast is colliding with them.
I’m new to Godot and game development in general, so any tips on optimization or general design is much appreciated. I’m using Godot 3 btw. Thanks.