Update Objects state / visibility eventbased / on overlap

Is it possible to update or refresh the visibility of an object only on overlap? Example:
The player (the trigger sphere) finds on the first picture the cube.
Now the player leaves the area with the cube, so the trigger sphere is not overlapping anymore with the cube (picture 2). Now the cube gets destroyed (still picture 2), and here is the point:
The cube should stay visible (as on picture 3) until the player is overlapping again with the cube, as on picture 4. So the cube is destroyed but is still visible for the player, until his trigger sphere is overlapping again.


My current approach is to spawn a ghostbuilding, as soon the trigger Box is not overlapping anymore. Not good …

Thanks for any hints.

You could add a collision component to your actor blueprint, set its collision settings to overlap all, and create an Begin Overlap event.

Thanks a lot for your answer. Yes, but how can I handle it, that the cube stays visible even when it gets destroyed?
So basically, what is need to be done on Begin Overlap, maybe like something refresh or update only on Begin Overlap?

I don’t quite understand your question. If the cube is being destroyed, then it’s not going to be visible because it doesn’t exist anymore. You can hide/unhide the cube programmatically on Begin Overlap/End Overlap, but I don’t think this will affect the collision. In other words, you could still collide with the cube, even if it is invisible.

You are exactly speaking out, what I thought. When an object is destroyed, it won’t be rendered anymore, because it doesn’t exist. The only way, like you pointed out is to hide the mesh. What you might be able to is hiding the mesh (not destroying) and change the collision response to ignore pawn. The player can’t collide with it anymore, but it won’t fall through the ground :).

I see, the question is not clear, but it’s exactly the problem.

I have two players. Player1 AI finds the cube and picks it up. Player2 should not see that the cube is gone, until he explores the region himself. In order to do so, I’m rebuilding the cube as a “ghostcube”, only visible for player2 until he explores the region with the ghostcube himself. As soon as he is in line of sight with the ghostcube, it gets destroyed. Now player2 knows, that the player1 picked it up faster.

This “rebuilding the map” approach reveals performance issues. So I was hoping for kind of magic visibility rendering trick.
But I think I need to search another solution.

Anyway - Thanks a lot for you help!

So are you basically showing a whole area with everything like say a large top down maze where you can see boxes everywhere but your on the other side of a wall. Technically you as the overseer can see over the wall but player character model can’t. So until true line of sight it’s not showing that it’s actually gone?

Ah, I see what you want to achieve. Just like fog of war in RTS games.

Then hiding the stuff is actually the thing you want with the addition of destroying the ghostcube, if the second player goes near it. You can go the complex way, but I will try to make an easy solution for you. I make a little pickup as an example.

Hope I could be of help.

Wow! Thank you so much for the vid. I think this will solve the problems.