Hide objects from 2nd Camera

Hi All,

I am coding a FPS game and have a hotkey that when pressed changes the view to a 2nd camera. This is meant as a replacement for the standard paperdoll and would allow the player to view their character and the environment but I would like to hide all AI and Other players from this view.

Can anyone suggest a good way to code this? I have tried playing with the camera settings, but it seems without some engine level code changes this cannot be done.

Any suggestions or tips would very welcome!

Thank you all in advance.


That all depends if this game is multiplayer, if both cameras may be used at same time.

And because you did not say anything about those conditions i assume easiest version, that only one camera can be active and its singleplayer game:

Create either dispatcher or blueprint interface, i think dispatcher is better here.
So create dispatcher in player controller, that gives boolean “hide?”
Then every actor that needs to be hidden assigns to that dispatcher.
When you call that dispatcher they all hide/show self according to that “hide?” variable.
You need to hide visuals only, so stack them all in hierarchy on top of some single component. Then you change that component visibility and tell unreal to propagate it to children.