I have been trying arroung with the top-down template a bit and tried to figure out a way to handle the visibility of objects, that hide you character when you walk behind them. Imagine you are in a little town with houses which you can enter. Now in order to see your charcter you need to hide everything that is hiding it, like wall, ceilings and maybe even props.
Here is what i have tried so far:
Use a material parameter collection to store the position of the character and make stuff that occludes him invisible. However, this approach doesn’t look very good, thats why I threw it out of the window.
My second approach is, to make everything part of a special blueprint type, that has events you can trigger, which then will hide / show the mesh by settings its visibilty. This works, but i have some problems:
How can i determine wether a BP should be triggered to be (in)visible? I tried using rays. The problem here is. that if you use Small modular assets for walls, it will only hide the pieces that actually occlude the player character. I want it to hide whole walls, that might hide not only the character, but also important parts of the room. The effect i would like to achieve is like in the game “The Sims” (Screenshot: 7games7.com) As you can see here, all the bottom walls + the ceiling of the room are hidden. I wonder how it is determined which walls to show and which not, based on camera and character position
Is there a way to make a mesh invisible but keep casting the same shadows at it did before? Also, cann i somehow change a meshs collision channel at runtime, so it wont interfere with the mousclick traces that the playercontroller makes when it is not visible?
But if you’re looking to do something similar to what’s shown in that image, you might be better off using a Trigger Volume around your building. When the character enters the volume, you Hide the specific walls you want (looks like bottom and left walls in that image) and ceiling, and leave all other actors visible.
If you are using static lighting, shadows will remain when actors are hidden. Dynamic shadows will not remain. When an Actor is hidden, you it won’t be picked up by your mouse clicks.
That’s just a variable of type Actor set as an array. We’re using it to make a list of Actors hit by the Line Trace and hiding them all, then unhiding them when the Line Trace is done.
This isn’t a perfect setup, though; in effect, this will hide all Actors the character runs behind and they will all remain hidden until the character isn’t behind anything. That’s probably not what you want, and you’d need to implement a way of unhiding an Actor once the Line Trace isn’t hitting it in particular. That’s a bit more complex, but this is this setup is a good way to start.