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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Button or Input Filtering?

Right now I have a top down character who moves using the W, A, S, and D keys by using AddMovementInput . However this allows the character to move in diagonal directions if multiple keys are pressed. Does anyone know of a way to constrain movement strictly to one axis at a time?

I would also love to hear of additional ways of moving my character besides AddMovementInput if anyone happens to know a good one :P .

Product Version: Not Selected
more ▼

asked Apr 10 '14 at 05:41 PM in Blueprint Scripting

avatar image

21 1 3 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

I believe AddMovementInput is safer than changing movement manually. Unless youre Actor is not a Character but a ship or object of some sort. Here is what I came up with question.

alt text

If I figure out another way to do it, I'll make another post. I tried few ways and this seems to work best. On the left the keys WASD assign themselves, and on the AddMovement where it applies the Axis Value. You detour the axis when its the opposite axis. Only kink I noticed is when you hit a button on the same Axis such as W & S. When you're holding W, and you hit S you stop moving. Otherwise, it constrains to one direction at a time.

inputconstraint.jpg (228.4 kB)
more ▼

answered Apr 10 '14 at 06:44 PM

avatar image

2.1k 75 37 111

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Instead of using the InputAxis Events you could try using the InputAxis Values and then driving movement from your Actor's tick event. Then you can examine the value of both axes and make a decision on whether you want to update the movement or not.

more ▼

answered Apr 11 '14 at 12:09 AM

avatar image

Marc Audy STAFF
2.2k 42 35 95

avatar image PeterLNewton Apr 11 '14 at 06:38 AM

There decision is still required. Meaning to determine if this is the Axis they want to be on. Also, you would have to assign Axis. Example, if you have them going forward. You would assign the Axis as Forward & Back, but if you go back, then release. It resets the permission. So then this requires individually adding permission. There must be an alternative because the solution I provided still feels like too much to me.

So if anyone wants to provide an answer, I would love to see it.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Check the absolute value of both input axis against each other.

If forward input is bigger than right input, use the value of forward input and set the right input to zero. Vice versa for the right input.

more ▼

answered Sep 27 '15 at 02:43 PM

avatar image

199 15 26 33

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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