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"

How do I make a touch input controller that moves the character in the direction of the slide?

Essentially, I have a player character that moves only along the X axis. I'm trying to setup the controls in such a way that the character will move based on the direction that you swipe, but only along x. In a nutshell, I'm looking to build a control system in which you tap, hold and slide your finger around to move the character.

Any help is greatly appreciated!

Product Version: Not Selected
Tags:
more ▼

asked Mar 07 '15 at 12:23 AM in Blueprint Scripting

avatar image

Phlux
44 16 19 25

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

2 answers: sort voted first

Hey there, so like promised, I updated my answer to better illustrate how you could achieve this. But instead of using images I made a quick video tutorial instead (5-ish minutes) http://youtu.be/fogqRl5b3kw

I hope that this was helpful!

more ▼

answered Mar 07 '15 at 01:00 AM

avatar image

Mortusnyte
916 45 20 77

avatar image Mortusnyte Mar 07 '15 at 02:34 AM

If you want to be able to move not based on where your character is but based on where you press and swipe from; Do the same thing as shown in the video but instead of comparing with the character's world location, create a new vector variable that you will set after the Input Touch Event Pressed and before the branch that checks if the player is touching the screen. Set that vector variable using the Input Touch node as explained. Then in the Compare float from that sequence instead of comparing with the character's capsule world location, compare with the new vector variable that you created. So basically when you touch the screen it records that location and then it will check whether the player's finger is left or right of that location until the player releases.

avatar image Phlux Mar 07 '15 at 03:08 AM

Thanks a lot for the video. You are a gentleman and a scholar. This is exactly what I needed and I really appreciate you taking the time to help me out. :D

avatar image Mortusnyte Mar 07 '15 at 03:26 AM

No problem, remember to accept the answer if it suited you for tracking purposes :) Take care!

avatar image Nick Jackson Apr 23 '16 at 03:49 AM

Great short tutorial - well done ;)

One comment about this segment in the video. The reason you can't find it is because you have Context Sensitivity on. If you turn that off, you will be able to find it :)

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

To break it down, you want to capture the initial touch, then you want to update a delta value (the amount of difference between initial touch and where the user is sliding his finger), probably every frame. So that way you know if he's sliding his finger in front or behind his initial touch. Then you apply a positive or negative movement control on the character.

I'm not going to get into the specifics, there should be enough documentation to get you there.

more ▼

answered Mar 07 '15 at 01:01 AM

avatar image

DanaFo
242 17 27 36

(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