Transfer to camera from player

Hello,

I am trying to transfer the camera from the player to another camera in the scene, when the player is in the trigger box, by pressing a key. (the script is called in the player BP, that’s why it’s a custom event in BP attached (transferToCamera).
The script I wrote (by getting info from internet) is working as supposed, the problem is that I transfer only the camera and not the controls/mouse.
What I am trying to do is to transfer to this camera that has it’s own set of commands, like pressing buttons, etc. I will need the mouse to be activated so I can see where I click. Ofcourse, I would like to limit the camera rotation to just a few degrees in all direction.

A good example of what I want to do is like when you see a tablet on a table, and you want to transfer to it (like holding it in hands) and do some specific commands in the tablet by mouse clicks on different buttons/icons.

Thank you!

If you want control, you can’t just have a camera, it has to be some sort of pawn or character with a character.

If you want smooth transition between the cameras it might be more complicated but if you just want to switch then as ClockworkOcean said, best to use pawn. Basically make a second pawn (might set default ai controller to none) and just possess that when needed and repossess your old one when done.

At least that seems like the simplest approach.

https://docs.unrealengine.com/en-US/Gameplay/HowTo/PossessPawns/Blueprints/index.html

Hi,
Thanks for the answer. Indeed my, blueprint is a pawn.
Please see attached my blueprint till now. I managed to get a smooth transition from the player to the camera but I have other problems now, that I cant solve:

  1. I need to add a small camera rotation ammount
  2. when I press the “InputAction Interact” button (defined in project settings → input) nothing happens

What is wrong?

Hi,
Thanks for the answer. Indeed my, blueprint is a pawn.
Please see attached my blueprint till now. I managed to get a smooth transition from the player to the camera but I have other problems now, that I cant solve:

  1. I need to add a small camera rotation ammount.
  2. How can I disable the HUD (is not working with the “Set HUDclass” function, only if I am doing something wrong.
  3. when I press the “InputAction Interact” button (defined in project settings → input) nothing happens.

What is wrong?

What I (or probably we) meant:

  • Make a pawn for your player. This is probably the character you already have. Walks around, whatnot.
  • Make a pawn for the camera. Give it certain inputs, like that rotation you want with said limitations etc.

When you want to switch you can just tell the player controller to possess the camera’s pawn and when you want to exit it just tell it to possess the old pawn.

You might want to do the set view target first and then possess. You are doing some possession I can see that but the whole thing looks a bit overcomplicated tbh. Shouldn’t it suffice just doing this much:

PS.: Just a personal advice (well, the whole thing is tbh) I really had quite a few problems with switching input modes in the past. The following article is pretty good in one of the most important ones:

I’m not entirely sure it is still a present issue in the current version but I’m guessing it is. I’m not good in actual C++ so instead of using the code provided I just opted to not switch around and made a completely 3d menu. It solved a ton of problems I had with widgets too - and brought forth a whole new can of worms. Like how translucency is sometimes a deathtrap in the engine and how dither AA is a good friend :slight_smile: