Switch control to another pawn but don't switch the camera

I am trying to create something like a debug cam that I can use to move around the scene. One requirement I have is to be able to “detach” the control from the debug cam back to my character pawn so that all inputs are handled by my character and the debug cam keeps looking at the location I left it at.

I have created the debug cam using a spectator component. The switching between the character pawn and the debug cam pawn is triggered by a hotkey and handled by implementing in the game mode blueprint and it works pretty well.

But I am not sure how to implement “detaching” the controls from my debug camera pawn while keeping it “active” (I should still be able to see “through” the debug cam pawn) and allowing my character pawn to be controlled.

One way I thought of was to posses my character first and then use “Set View Target with Blend” to set the camera back to my debug cam. But this feels weird and inefficient. Moreover, I have noticed that when I switch back to my debug cam pawn (which is of a spectator class), although it remains in the place that I left it, it goes back to looking in the direction that it was set in the scene. This is something I want to fix too but not something that I have looked into right now.

Is there a better way to do what I am thinking of?

If you want to control Pawn A but see camera from Camera B, then you should make sure that the player controller is Possess-ing Pawn A but using Set View Target With Blend to make the view be rendered from Camera B.

(And, yes, “View Target” is a terrible name for the property – it doesn’t mean “what you’re looking at” but instead “where should the renderer go to get camera information.”)

1 Like

Thanks! That is pretty much what I was planning to do.