how to hide the roof in some level in top down game

im working on a top down game that in some part of it player character and enemies are in buildings and camera nedds to be in good distance to see everything.

i thought its better to add no roof to my buildings but in some buildingthere are game play in some floors .

i think the techniqe that many games use is they hide objects upper head of player character but i dont know how to do it un ue4.

i think its possible to do it programatically.

thank you for helping

A simple solution shouldn’t be so complicated:

Simply use raycasts to identify if an object is between the camera and the player. If it is make that objects invisble.

In most cases this simple solution wouldn’t suffice as you need more control over which objects to hide (e.g. only hide roofs, but no walls). You could introduce a bool which you can set in the editor to flag objects for blending out.

You can create an actor class that represents a building, containing an array of objects and each object is a floor of that building (with floor, walls and furniture/items). Let say your character enters the building through the main door on the first floor. You can then loop from second floor to the top floor and hide the objects and now you have clear view of the first floor. As the player go up the stair, you can show object in the array index 1 which is the second floor. Disable it if he go down. This can be extended to as many floor as you want. Just keep in mind that each for will have to be a separate object or a group of objects

Hi virtouso,

There are actually a couple people here who are experimenting with a few options in their free time to achieve the effect you described, mostly using Blueprints and Materials. I am not sure how far along they are, but I will let them know about this thread and see if they can give you some ideas once they have been able to put some more work into it.

thank you tim licoln. i will be gratefull.

but i have a question too. under name of you and some other users is written “unreal engine developer”. what does it mean? is this mean that you work in epic and you are there because you know most of things and to answer to other users? sorry if you think im rude.

Hi virtouso,

The “Unreal Engine Developer” tag under our names indicates that we are working at Epic Games on the Unreal Engine team. We all have parts of the Engine where we are most familiar, but we try to be helpful whenever and wherever we can.

wow. thats cool. thank you mr lincoln.

I ve done that, i check if the player is verticaly under a floor and if it s true i hide the floor and its children.
The problem is that, as i understand it, to have a proper lightning the building should be static but to be hidden it must be movable.
Does anyone have a clue there ?