Download

PlayerController acting weird, only one axis working at a time

Hi Together,

I created a new empty project and setup a camera for a top down view. Y Axis is left and right and X Axis is up and down…

I Created the player controller like this

they are both identical. Weird from my point of view is that only “Move Forward and Backward” (up and down on screen) is working but not Left and right. If I cut the lifeline between “InputAxis FandB” and the “Set Velocity”, “Move Left and Right” is working fine. I can also Print the Input, Both Axis are working at all time but the velocity is always only set for one “Forward and Backward” or, if lifeline is cut, “Left and Right”…

Anybody know where my mistake is?

Thanks and regards,
Isa

That’s not the right way of going at this, you’re basically setting the other set of movement to 0, when moving in each direction, look at your code in those make vectors.

You could set those calculated values in 2 variables and then link them both to the Make vector node, but I would suggest to use an actual "add movement input node, like most of the templates. Though generally both will work.

I see, thanks for pointing me into it. I don’t want to use “add movement input” because it has a curve like behavior and it doesnt stop moevment when you release the key. I want a plain move left right at full speed and stop when key is released. Looks like I have to dig into that deeper.

Thanks again, I can see my mistake now.

Best regards,
Isa

I see, however read my post again, I already mentioned an alternative too, which will make the current set velocity node work as you want.

like this

sorry for the really crappy paint image

I’m afraid you can’t do that like this IF you’re using a real character like the ones that comes with the templates. Why? Because the character can only “start moving” in the direction that it’s facing and the opposite one. In other words, you have to turn it first to face right before you be able to tell it to walk towards the right. However about this:

I just tested to be sure and I can confirm that using either AddMovementInput or AddInputVector, does in fact stop the movement immediately once the key is released. So if it doesn’t work for you, you should try to see what wrong with that instead of trying to recreate movements from scratch.

Not that it can’t be taken care of with SetVelocity node, but it’s at least 3 times the work to get it right, and I can’t see a good reason why not to use the input nodes in the first place, so try using them like in the templates, and post the particular problem you have with it, if any.

Thanks! That works perfect.

@Farshad12
I set gravity to 0 so the ground friction does not stop my little space ship. Sorry I should put that information in the first post. But after your post I added flying friction to the same value as ground friction (8.0) and you was right, now the ship stoped after I released the key. But I still had that curve like behaviour. Starting slowly and getting faster and faster (due to the ADD vector or ADD Movement). I tried to set maximum speed to the initial vector size but that didnt worked out. But the Solution of Zureal works great. I did know that a lifeline output can only have one input but I never considered that an Input Node can have multiple Lifelines as Input, that was the key.

Best regards and thank you both for your help,
Isa