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:

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

This is the blueprint for the game controller:

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-)

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. :-/)

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

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.

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)

What else could possibly be wrong?

Anyways, thanks a lot for your help, CleanCut!

Shoot. You’ve got me stumped.

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.

@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!

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

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:

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?

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

122594-screen+shot+2017-01-18+at+8.58.36+am.png

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.

I’ve tried it, just after you suggested it. Still no dice, unfortunately. :frowning:

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?

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.

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