PaperZD character always looking towards the same side after moving in opposite direction

I’m not sure if this is the proper category for the question :thinking:

My problem is as follows. I did a tutorial for a 2.5D platformer game that used the default ThirdPerson template for everything, and it went well. However, I want to use 2D sprites for the characters moving in that 2.5D plane, and therefore I made the PaperZD blueprint with everything and it was a simple matter of replacing the ThirdPerson character for my PaperZD character in the GameMode (after adjusting the animation sources for the PaperZD animations and all of that).

It all went well, but despite being a literal copy from the ThirdPerson (I mean, I copied the settings so that the work made on the ThirdPerson for the 2.5D movement would work on the PaperZD blueprint), when I move the character to the left, it runs left but if it stops, it immediately looks to the right. I also noticed that the camera is not panning to the left when the character moves left, something that it did happen with the ThirdPersonBP.

I’ve ran out of ideas of things that could possibly make my character to always look to the right, from a drifting stick (despite I use a Dead Zone modifier on my Input Mapping Context) to the CharacterMovement detail that says this:
image
Just ignore that bigass number; I used that to make the ThirdPerson character to rotate instantly instead of turning around slowly.

If you have any idea on how to fix this issue, I’m open to anything. I’ll add a GIF showing the issue in motion:
STOP-LOOKING-THAT-WAY
And I suppose that showing how it worked with the ThirdPerson character will not hurt. I basically want to achieve the same effect but with my PaperZD character :sweat_smile:
WANT-TO-PRESERVE-THIS-EFFECT

Try ticking the USeControllerDesiredRotation option there in the character movement comp, then on your input axis event, use branches and set the control rotation to face left or right if the x axis is greater than or less than 0:

The yaw values used will depend on which world axis is right and left for your project.

I’d like to do that but, the default ThirdPersonCharacter uses this for movement:


Where exactly should I add these branches? :thinking:

Stick the >0 branch just after the forward/backward add move input node.

Somehow, when I added those nodes, the controls were inverted and once the character looks to the left, it keeps now looking to the left, which is the same problem as before but with the controls inverted :thinking:


INVERTED-AND-SAME-PROBLEM
I swapped the > and < just in case that was the problem, and it does the same as with the maths in the original places :confused:

AH! I forgot to add the Yaw rotations

Oh dear, what I did wrong :sweat_smile:
FLATTENED
Perhaps it needs 180º instead?
OK, even with 180º in the Yaw values, though the controls are not inverted now, the problem I had from the start remains the same as if I didn’t add these new nodes. It keeps looking to the right no matter how I walk him to the left :sob:

How is the PaperZD anim bp choosing when to flip the sprites? If the control rotation is fine now, I’m guessing maybe it’s using velocity to select sprite direction?

I think you mean this?


I’m not quite sure where, but then I remember, the guy in the tutorial never ran to the left and probably because of this he didn’t stumble with this problem? :thinking:

I’ll go check his tutorial again. In fact, I stopped middle way because when he finished showing how to add the DASH feature (it didn’t work for me) is when I tried to move in the opposite direction and found this problem. Now that you mention it, he never set up the StateMachine up to that point… OK, let me re-watch the tutorial and ignore this problem until I reach the end of the video. If it isn’t fixed by then, I’ll come back :flushed:

Are you setting the scale of the sprite component anywhere to mirror it? Some paper tutorials say to do that as a way to flip animations. I’m not seeing anything in PaperZD about flipping sprites, and my quick test project character is facing the correct direction when using control rotation.

I just rendered out some sprites and threw a fresh test character together. If you want to try it out, you can download it here

Unzip into content folder in project directory. May have to edit default pawn in your game mode (or override), and change the enhanced input class in the character bp though.

If wrong engine version, I can migrate it and reupload.

I’m kinda feeling that you’ve already solved your problem by now. But if not, here’s how I patched it up:

First we make a variable called “LastVelocity” .Then we use Event on Tick to keep track of the character’s velocity. If the velocity is {0,0} aka character’s idle, we keep feeding our LastVelocity from itself. Else we give it the X & Y of the current Velocity. This way It’ll stay still in the direction it was moving towards.

Hope it helps !

1 Like