x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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? alt text

thx

Product Version: UE 4.18
Tags:
mouse-input.jpg (533.2 kB)
more ▼

asked Apr 07 '18 at 02:50 PM in Blueprint Scripting

avatar image

LordZedd_02
11 2 2 4

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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.

alt text

more ▼

answered Dec 15 '18 at 12:18 PM

avatar image

LordZedd_02
11 2 2 4

(comments are locked)
10|2000 characters needed characters left

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. alt text

mouse-settings.jpg (181.1 kB)
more ▼

answered Apr 07 '18 at 09:35 PM

avatar image

Nebula Games Inc
3.9k 21 9 14

avatar image LordZedd_02 Apr 08 '18 at 11:08 AM

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.

avatar image Nebula Games Inc Apr 08 '18 at 12:54 PM

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.

avatar image LordZedd_02 Apr 14 '18 at 03:44 PM

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

avatar image Nebula Games Inc Apr 14 '18 at 03:49 PM

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.

avatar image LordZedd_02 Apr 14 '18 at 04:16 PM

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?

[1]: /storage/temp/237484-door-pawn-blueprint.jpg

avatar image Nebula Games Inc Apr 14 '18 at 04:45 PM

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.

alt text

switch-pawns.jpg (205.9 kB)
avatar image LordZedd_02 Apr 15 '18 at 06:19 PM

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

avatar image Nebula Games Inc Apr 15 '18 at 06:24 PM

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".

avatar image LordZedd_02 May 06 '18 at 12:16 PM

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.

alt text

avatar image Nebula Games Inc May 06 '18 at 12:58 PM

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.

avatar image LordZedd_02 May 06 '18 at 02:41 PM

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. alt text Sorry im new in UE and a lot of things is pure abstraction for me.

possess-bp.png (332.4 kB)
avatar image Nebula Games Inc May 06 '18 at 02:54 PM

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.

avatar image LordZedd_02 May 06 '18 at 03:46 PM

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.

avatar image Nebula Games Inc May 06 '18 at 05:18 PM

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!

alt text

door-bp.jpg (207.9 kB)
avatar image Nebula Games Inc May 06 '18 at 05:23 PM

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!

avatar image LordZedd_02 Dec 15 '18 at 12:20 PM

I finally found the answer, thx for help.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question