When my player goes behind walls/buildings, i’d like to hide objects which are blocking the view. I’ve thought about a Multi Sphere Trace from camera position to players’ position, and hide objects in certain radius which have “hideable” tag or something (so for example it won’t hide monsters)
Is this a good solution? I assume that in this case i need to do Multi Sphere Trace every tick - will it not cause too big performance hit? Or maybe there are better ways to achieve this?
I’m not sure about what you want exactly, I understand that you want to hide objects, but keep showing your player, is that true? maybe this would help: http://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/
To clear it up: Diablo 3 - Barbarian - Gameplay - YouTube
In 9:21 - this shows what i want to achieve. You can see that when player goes behind the column, it fades out, because it’s between camera and player (it’s blocking the view)
I will read about this custom depth, but i guess that just hiding objects would be simplier. I’m only curious about performance cost when using Multi Sphere Trace every tick.
Ah, now I understand what do you want.
Like you said, you can use raycasts to identify if an object is between the camera and the player, and hide it. But I don’t know if that is the best solution for performance.
Also you can use something like this: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums
You can attach that volume between your player and camera inside your character blueprint.
One of the ways to implement it, is to use invisible static mesh component with a mesh with cone-shaped convex shape - and then, hide objects that are overlapping it. It’s probably more performance-friendly solution that raycasting. The idea was provided by JamesG from THIS thread.