Making all props within another prop invisible

CONTEXTUALISATION

I’m creating a TopDown game which has some buildings the player can get into. These buildings, sometimes, have several floors; sometimes they don’t. As you may know, these TopDown games usually make higher floors (plus ceiling) invisible in order to make players be able to see their characters inside the building.

The thing is: for my game, is crucial that every actor on a given invisible floor is invisible as well, to hide the treasury that floor hides.

So far, what I’m doing:

  • Using MultiCapsuleTraceForObjects, I’m able to get all the actors that touch the SpringArm of my camera.
  • With these gotten actors, I’m able to do something with them as well. Currently, I’m applying a transparent material to them and making them ignore mouse-clicks to make the player able to navigate through the floor he currently is.

It not only works, but it scales, and this is important: my level designer doesn’t have to bother about anything else but designing the level itself.

THE PROBLEM

Unfortunately, props/actors within an invisible floor aren’t invisible or hidden. That’s expected, though. At this point, I did nothing with them. But I sincerely don’t know how to get know about them. If I’m in the first floor, programmatically speaking, how do I get all the content inside of the second, third, X floors?

MISC.

  • The building was designed modularly, meaning that the first floor is a prop; the second floor is another prop; the third floor is another prop; the ceiling is yet another prop. They all are detachable; no strings attached.

If the props are “within” another prop as suggested. Then when you return the object from the sphere trace, you could get all of the actors that overlap that actor and hide those too.

If not actually within, then you could make each floor a BP, with an box volume set to overlap, and then get results from there.

The only change for your LD would be that when they place floors, they place BP’s instead of static meshes.

Hey, thank you for the quick response.

So, I’ve tried your first suggestion about getting the overlapping actors (thank you for it btw). The problem is that it doesn’t work. I mean, it doesn’t return any overlapped actors, even though the floor has props inside. And yes, I’ve already made that floor Generate Overlap Events. Take a look:

https://i.imgur.com/AupLnee.jpg

The treasure is the content. A completely separated prop. It simply isn’t returned on Get All Overlapping Actors as seen here:

https://i.imgur.com/H3kcpyL.png

As you can see above, I’m trying to get all the overlapping actors of the given prop the sphere trace is returning me. Though it is generating the overlap events, it doesn’t print the string with the actor’s DisplayName.

Try setting the class filter to “object” or “actor” on the get overlapping node. Also, if you want the floor to overlap objects that are floating, you’ll need to think about a solution for that case. Because currently everything needs to intersect with the floor

Actually, the problem was different: even after making my floor Generate Overlap Events, I had to make it overlap WorldStatic in the Collision Settings. After that, it worked properly.

Also, I don’t think I’ll have floating objects. Not a worry for now.

Thank you for the help, CupMcCakers. The problem was solved.

seems like you figured it out :slight_smile: nice one