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"

Why does my character move to a specific spot in the game world?

Hi there, I have a problem regarding movement in the Top-Down template, created for mobile. The idea of the game for players to tap on screen to move the character, like an action RPG, with the added feature of swiping across the screen to dash/dodge. But for some reason, my character moves to a specific spot in the game world, every single time.

Running the game would have it normal, like this: alt text

But tapping anywhere, anywhere at all, will cause the character to move to this one spot and wouldn't respond to any input: alt text

This is the blueprint for the game controller: alt text

The "True" output of the branch goes to the dash/dodge blueprint, which works fine. Oddly, if I connect "Move to Hit Location" directly to either of the "Pressed" or "Released" output of InputTouch, it works fine. I couldn't understand why my character would go EXACTLY there; there was an obstacle there, but I removed it, and he still goes there (as if stuck to the wall, unable to advance further).

Thanks in advance!

P/S: Tap/swipe blueprint credit to this thread: https://forums.unrealengine.com/showthread.php?68473-Mobile-Touch-Swipe-Tap-amp-Dbl-Tap!-Get-it-here-for-free-)

Product Version: UE 4.13
Tags:
more ▼

asked Jan 16 '17 at 05:37 PM in Blueprint Scripting

avatar image

ChokusenDoro
1 1 3

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

1 answer: sort voted first

According to your description, one of your nodes must be returning a NULL and stopping execution. The most likely one that I see is the Get Input Touch State, where you are always trying to get Touch 1, regardless of which touch actually happened. I recommend wiring up your Input Touch's output pin Finger Index to your Get Input Touch State input pin Finger Index and see if that fixes it.

If it doesn't, then just inserting a Print String between every node should help you find where your execution stops. Or you could try setting a breakpoint...but I haven't had good luck with that myself. (Nothing like trying to use a debugger...which crashes. :-/)

more ▼

answered Jan 16 '17 at 07:02 PM

avatar image

CleanCut
2.1k 67 84 77

avatar image ChokusenDoro Jan 17 '17 at 05:52 AM

It doesn't work, unfortunately. I've connected the finger index node to "Get Input Touch State as per your recommendation, but it still does the same thing. I can still move around by swiping (dodge/dash). alt text

However, wherever I go after dodging, a tap/click sends my character back to the exact same spot, regardless of where he is relative to that point in the game world. alt text

I've also included print string outputs to check where the execution stops, but everything seems to be in order. (Notice the printed strings in the above screenshots) alt text

What else could possibly be wrong?

Anyways, thanks a lot for your help, CleanCut!

avatar image CleanCut Jan 17 '17 at 06:00 PM

Shoot. You've got me stumped.

avatar image shotty46290 Jan 17 '17 at 08:53 PM

The problem is in where your movement is. It's trying to move then failing on a reference you are using in his movement so he moves to 0,0,0 of the world. Print a string on tick of his world location. I bet he's going to 0,0,0 which means the move node can not get the data you gave for him to move.

avatar image ChokusenDoro Jan 18 '17 at 05:06 AM

@shotty Alright, I'll try it out soon, when I get to boot up UE4 and post results soon after. Thanks for the tip!

If that were the case, how would one go around fixing it?

@CleanCut Hmm... Nevertheless, thanks for the help!

avatar image ChokusenDoro Jan 18 '17 at 08:43 AM

I've tried getting his coordinates with every tick, but it doesn't seem to end at 0,0,0... This is really weird.

alt text

And turns out, it doesn't just stop on ONE exact location. After dash/dodging and clicking, the character moves to that spot again, but the coordinates are a bit off:

alt text

avatar image ChokusenDoro Jan 18 '17 at 09:46 AM

Out of curiosity, I tried to swap "Get Hit Result Under Finger by Channel" with "Get Hit Result Under Cursor by Channel", it works fine... but I'm planning to porting this game to mobile, though, so I don't think "Cursor" would be a good solution... What could be causing this? alt text

avatar image CleanCut Jan 18 '17 at 04:00 PM

Your editor doesn't have touch unless you are running the Mobile Preview (PIE). Were you not doing that? alt text

avatar image ChokusenDoro Jan 18 '17 at 05:30 PM

I've tried it, just after you suggested it. Still no dice, unfortunately. :( alt text

avatar image shotty46290 Jan 18 '17 at 05:16 PM

I would have to build a copy of this and test to be able to tell you, and a heads up set your print string of his location to 0 duration, and it pretty much just keeps track of him. There would be only one X and one Y changing their values.

avatar image ChokusenDoro Jan 18 '17 at 05:34 PM

Thanks, I'll be waiting for your response. Though, I don't really understand what you meant when you say "set your print string of his location to 0 duration", if you don't mind, would you care to explain what you meant?

avatar image shotty46290 Jan 18 '17 at 07:03 PM

If you press the down arrow of your print string node there is a float value default of 2, that is the amount of seconds your print string will show, so if it is on tick and you set the duration to 0. It will just be like a gps only showing X and Y one time with the number of the axis location, and the number constantly updates since it is running on your tick.

avatar image henbull May 14 '18 at 04:24 AM

Hi, did you end up figuring it out? I’m stuck on the same issue.

(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