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"

In first person template why do I Have to click the mouse before I can move my character?

So two things and they are probably both relatively simple but I forgot how to do a couple things. One. When starting my game similar with the first person template I press alt p or play and go at it. But you HAVE to click the mouse first before you can do anything. How can I get rid of that??? It's odd that you even have to do that.

And two. When I open a menu in game up I would like all of the input commands to change. Kinda like instead of moving the character it moves a curser to differenr sections of the menu. I'm guessing I need another player controller right???? Can someone tell me how to switch that in and out for my pause menu?

Product Version: UE 4.13
Tags:
more ▼

asked Jun 15 '17 at 03:08 PM in Blueprint Scripting

avatar image

AttemptD
1k 165 162 354

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

2 answers: sort voted first

To answer your first question, the problem is the game's window isn't focused. So you have to click to focus the game window. To fix this, just use the Set Focus to Game Viewport BP node on begin play. You may also need to use the Set Input Mode Game Only node.

As for your 2nd question, there are many ways you could go about doing what you want. One easy method is just with a simple boolean on your character. For example on your move forward event, have your bool hooked up to a branch node. If the bool is true, your character moves forward. If the bool is false, an event/function is called on your widget that moves the cursor up.

more ▼

answered Jun 15 '17 at 08:23 PM

avatar image

drb1992
253 7 22 30

avatar image AttemptD Jun 15 '17 at 10:17 PM

Ok the first part worked perfectly thank you!!!

The second part is working I have it marking the cursor go up and down as you said but the only problem is that I only want the cursor to go down 1 interval every time the button is pressed. I have it going up or down based on weather it's greater than or less than 0 but it just flies either direction off screen. How can I make it take the input only once untill I do it again? Instead of constant like movement would be???

avatar image drb1992 Jun 15 '17 at 10:53 PM

Use a Do Once node and On Release of the button, reset the Do Once node. Alternatively you could just move the cursor On Released instead of On Pressed.

avatar image AttemptD Jun 15 '17 at 10:55 PM

This is a axis node so there is no pressed or released. It's set to move the character foward and backward like in the FP setup.

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

When I run my games and click "Play in viewport" I don't need to click into them before the mouse capture takes over. I'm not even really aware of a setting that changes that, so that sounds kinda weird to me.

As for your menu logic, there's a bunch of different ways you can go about this. I wouldn't really recommend swapping player controllers, because your player controller is still filling the role of the layer between input and your game.

You could have your player controller dispatch events out to your widget, and disable events being sent to your pawn. Or you could have all of your input events be directly on the widget (I think you can do this. You'd have to explicitly enable inputs on the widget)

more ▼

answered Jun 15 '17 at 06:03 PM

avatar image

Gorlock
21 1 7 8

avatar image AttemptD Jun 15 '17 at 06:48 PM

Simple if w,a,s,d move the character but once I pause the game I wasn't w,a,s,d to move a cursuer to different objects, an I switching player characters or controlllers?. And yes when I press Alt P. Before anything works I have to click the mouse button. It's like I have to click the screen before I do anything.

(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