Character rushes across screen after direction change

Hey guys,

got a little problem here: I made a simple 2D game to practice Blueprint scripting. Everything works fine so far, with little but grave exception that when I jump and keep jumping direction pressed, but do a direction change exact moment my character touches ground, he rushes away in direction he is now facing.

I’ve made a short video showing what my problem is (it’s kind of hard to explain). It occurs first at about 0:17 and can be seen four times: - YouTube

I’ll attach my movement Blueprint as well (contains additional flipbook settings).

Could this be a mistake I made or is this some kind of standard “feature” that I do not know of? Or could it be an engine bug?

Thanks for help! :slight_smile:

PS: I use some sprites from Nintendo in video. I hope this is fine, as it is only a practice game. If this is a problem, please feel free to remove link.

Hey, Artax!

I’ve been looking at your question for a while and I think I might know why it’s happening.

I’m not completely certain on how your axis value is set up, but I think if you’re turning when you land, it causes an unexpected Axis value which increases Scale Value in your Add Movement Input function to a crazy-high amount. That’s why you’re suddenly flying off to side. If you want to check and see if that’s problem, you could try having a Print String node that prints Scale Value value and see if it goes crazy-high when bug surfaces. Just a suggestion. :slight_smile:

Let me know if that helps,

Jonathan

Hey Jonathan,

thanks for your time and suggestion! I’ve just tried it, but value shows no abnormality whatsoever (neither axis value, nor final input value, I looked at both).

Interestingly enough, I made these 2 new observations:

  1. phenomenon only occurs when I keep first directional key pressed right up to moment when I want to switch directions. Leaving button unpressed just a split second earlier doesn’t trigger the “side jump”.
  2. I was able to reproduce phenomenon while walking on floor as well, if timing is right.

Any other ideas where that may come from?

Hmm. Do you think it’s possible that your character is somehow taking movement input from both left and right at same time?

I assume your ‘MoveLeft’ section looks just like this, with a different rotation multiplier?

Uhm… there is no MoveLeft ^^ All input comes from this one “InputAxis MoveRight” node, positive and negative, respectively.

Oh! I see that now.

Do you think bug is caused by game taking a left and right input at same time? Maybe use a Branch to prevent both inputs from happening together and see if that helps?

Hm… How would you set up that branch? Sorry, I seem to be slow on uptake at moment ^^ Maybe I should take a break. This is what I just tried, but it does not solve issue:

Hey, no worries. I realized I’m being a little slow on uptake too. I finally figured out that you’re using a modified version of Sidescroller Blueprint, so I opened that up and took a look. It looks like way Sidescroller Blueprint is set up prevents taking left and right inputs at same time, so that’s not problem.

I’m going to try to emulate your blueprint setup and see if I can reproduce bug. I haven’t succeeded yet, but I’m working on it.

In meantime, have you tried wiring InputAxis MoveRight directly to Add Movement Input? If that fixes problem, that means that bug involves Flipbook and Set Actor Rotation part of blueprint.

Oops. I could have mentioned that I used template ^^

I tried wiring Inputaxis event to AddMovement, but error still occurs. In case you’re not able to reproduce bug, can I be on any assistance, maybe by putting whole project into our SVN?

If you could send me your project, that would definitely be very helpful. Rather than SVN, could you upload it to Dropbox or and send me link over private AnswerHub messages?

Thanks!

Hey Jonathan,

sorry for late answer. I have uploaded project to my Dropbox. Now this may sound like a stupid question - but how on earth can I send a private message? ^^

Hey Artax,

AnswerHub doesn’t have a private message feature, but you can send Jonathan a PM on forums:

https://forums.unrealengine.com/

Okay, I’ve made a lot of discoveries, but issue is still eluding me.

Here’s what I’ve got so far:

First off, the ‘flying to far side of screen’ bug is caused by a smaller ‘teleport (or move very quickly) a short distance’ bug. Even if you’re on ground, tapping A and D repeatedly can sometimes make your character dash to side a little bit. If you do that while standing on a block, then you’ll fly off to side (like you showed in your video).

However, that little teleportation bug is crazy hard to track down. I’ve removed almost all of blueprint and nearly all of related assets, but bug still persists.

I’ve deleted everything else. only things that remain are this, and TetriskCharacter Defaults. character is no longer visible, but I have camera following him so I can tell when he teleports, and it still happens. That means it’s not part of your event graph, because Blueprint 2D Side Scroller character doesn’t have this bug, even when you simplify his blueprint to this.

only thing I can think of to try now is to make a new Character and just copy old one’s components and stats to new one until bug resurfaces.

Hey Jonathan,

Yay! I was just creating new character as you proposed and I think I found problem! I’ve set the “Ground Friction” to a very high value to better imitate movement of Mario. Seems like 1000 was a litte too much :slight_smile: I’ve reduced it to 200 and wasn’t able to reproduce bug anymore.

Would be great if you could try and confirm this discovery!

Excellent! When I set friction to 200, I can still reproduce it sometimes (by tapping A and D repeatedly), but setting it to an even lower number (like 5) makes it completely disappear. Finally!

I’m glad we finally found root of this problem, I was getting pretty concerned!