Making an actor invisible to camera only

I’m playing around with Top Down sample project, and I wanted to make walls invisible (or at least semi-transparent) when player character is behind them. catch is, I’d like hidden actors to keep on casting shadows and reflections normally. I tried playing with Visible and Hidden In Game, but they both make object stop casting shadows and reflections. Also, how do I detect that player is obscured by another actor?

I’m brand new to Engine, so please explain like I’m 5.

To hide mesh from camera, but still show shadows, set owner no see to true and cast hidden shadow to true.

This can be done in a Blueprints components tab (under Rendering & Lighting) or in C++, thusly:

void AYourCharacter::PostInitializeComponents()
    Mesh->bCastHiddenShadow = true;

I am not sure about detect when an actor is obscured, but I am reminded of this UDK gem:

Hey Artless,

Check out this post for a couple of options:

I set up a very simple Line Trace to hide an Actor while it is between camera and player that you can look over. This is put in EventGraph of your Character Blueprint.

It’s not most elegant solution, but it should help you get started.

Hope that helps!

1 Like

Thank you @ and @, I will try this when I get home.

I tried this, but it seems tick event refuses to fire. bAutoActivate is set to true, but nothing happens in BP. What am I doing wrong?

Hey Artless,

Did you put all that in your character Blueprint? When you PIE, and you have that Blueprint open, if it isn’t showing anything happening off your Event Tick node, change Debug Filter in BP Toolbar from “No debug object selected” to “MyCharacter_C” (or whatever_your_character_BP_is_named_C). Then you should see activity off your node on PIE.

Ah, that sorts it. Thank you!