Enable mouse input

Hi Guys,

I’m trying to enable mouse input (blueprint bellow) after changing camera using “set view target with blend”. I have tried
several methods and nothing seems to work. Any idea how to do this?

thx

What does any of that have to do with the “mouse”? I don’t even see a node relating to the mouse there. That being said, make sure you have mouse input enabled on your controller. See the screen shot below for some places where you can play around with mouse input. Also if you want “mouse input” to simulate “touch” that is something you can tick in the project settings there is an option under the Input tab to “use mouse for touch”. Hope this helps.

Hi, thanks for the answer, but I think I wasn’t specific enough and we talking about two different things.

What I’m trying to achieve is ability to peek through a keyhole (dishonored, thief style). I’m using actor class blueprint (door) with attached camera. When my character is in range of trigger it swaps from FPS camera to my “door camera” using “set view target with blend” and this is the part where i would like to enable my mouse input so I could look around using “door camera”.

I hope that this description will help.

So you have a FPS camera with full functionality, moving around etc works fine, then you enter a trigger box and switch the view to a camera on a separate actor (door) and you want to move that camera around? If trays the case you’d have to treat the door as a separate pawn, so that you “possess” it when entering the box trigger and then it should be able to receive controller input like your FPS camera. You would then “unpossess” when you want to go back to the main character.

I tried to create door as a pawn blueprint but it completely ignor my input and i cant interact with the door.

How have you set up that blueprint? You need to possess it before you can control it. Take screen shots and I’ll have a look.

Here is the screen shot. I didnt add possess function because it ignored my input however trigger works fine. Another question is if it starts working will I be able to add additional function to this blueprint like! specyfic key to open door or try to use lockpick?

I am confused by this set-up. You aren’t switching “controllers” so you shouldn’t be enabling and disabling “controller” input. What you want to do is possess/unpossess different pawns. So “on overlap” you want to “unpossess” the current pawn and “possess” the “Door” pawn. When you end overlap you switch them back.

Thanks for the screen shot I’ll give it a try. If I understand it correctly all of this must be in controller blueprint?

You don’t have to have it in the controller although that might make it easier. If not you will have to get a reference to the controller to put that into the object pin for “possess/unpossess” nodes. If it is in the controller you don’t need a reference the object is simply “self”.

You need an integer variable created on both player/controller and one on the door BP. Make the door variable instance editable. On overlap of the box trigger set the player integer to the integer of the door that particular trigger is in front of. Then make a function in the player that gets all door actors, run a for each loop and check player integer vs door integer. When they match you have the door integer you want to possess. So when you use the possess node and it asks for a controller number you use that integer. Then you will possess the correct door.

Hi, after a long break Im going back to the subject.

Your solution with switching pawns is working quiete good, hovewer there is one problem. When I have multiple doors and im possessing it than it pick up random pawn.

Example:
Im trying to possess door no1 but I end up in door no5 instead.

Is there any way to specify exactly which pawn should be possessed?
It’s worth mentioning that I have added new pawn blueprint to view port inside door blueprint and the whole possess/unposses function is also inside it. So meaby that’s the reason why it is not working as intended.

Ok thanks, but I get lost after “Make the door variable instance editable.” and I need a little guidance.

  1. You need an integer variable created on both player/controller and one on the door BP.
    So I’ve created two integer variables 1 - for player pawn, 2 - for door “player” inside door BP and my main character BP.
  2. On overlap of the box trigger set the player integer to the integer of the door that particular trigger is in front of.
    I need to hold down F key to use possess node so I’ve set player integer before possess function.
  3. Then make a function in the player that gets all door actors
    Where this function should be? Inside my main character or character that i want to possess or meaby inside my door BP?
  4. run a for each loop and check player integer vs door integer.
    I’m totally lost here.

Sorry im new in UE and a lot of things is pure abstraction for me.

Now that I think of it, you might just be better off making references to each of your doors in the level blueprint. Place them into an array so you know exactly which door is at what index and when you overlap trigger 2 for example get the 1 index from the array (this corresponds to the second slot since arrays are 0 based) and tell the player to “possess” that door pawn from the level blueprint.

It is impossible I’m trying to build hotel so there will be a lot of doors and I can’t make reference for each one of them, it must be something automatic. Going back to the beggining my whole setap is almost done all I need is option to move my camera a little bit while peeking through key hole. There must be another way to add mouse input other than pawn possession.

Here, try this. If you create you Door BP with the collision box built in, then possess the pawn on overlap of the collision box, you solve all of these issues. I had it possess and then unpossess after a delay. It was working fine. There are some errors that occurred with controller input not being able to access the original player character during the time it was unpossessed which was not fixed with “disable input”. Might just be the order of execution, I am sure you can figure it out with some trial and error. But as for the main issue of switching the camera back and forth this def. works, you wil just need to add your extra script for being able to control the camera through the newly possessed pawn. Hope this helps!

Solved! I was using a “get player character” node in my controller BP (which works fine for the player character since that BP was actually a character BP) instead of player “pawn” and since the door was a “pawn” not a “character” it was giving an error when the controller was controlling a “pawn”. So there you go! Everything works, just make sure to check “use pawn control rotation” for the camera component of the door and all your controls should work no matter if you are the player character or the door!

Ok so here is the answer for my own question.

All you need to do is to add “mouse Y and X” but it is important to unchecked “Consume Input”

Bonus answer if you want to limit rotation values use clamp node. For correct values use print node connected to event tick to print out yaw/pitch values per frame. Then check on what range you get the proper result.

I finally found the answer, thx for help.