A bit new to Unreal engine, I want the A Key and D Key input from the Keyboard to move the player to face a specific direction, with the W key resetting them to face forwards, it works fine so far. However, whenever pressing another key after one it starts the pawn rotation from default position. Causing a jarring Teleport between the two positions. I have managed to prevent the camera teleporting between positions by locking the key input through a Branch. However, this lock appears to be permanent after one use.
How can i reset this section for once the W key is pressed to allow the player to transition between A position and D position?
Couple of issues with code apparent, you donāt appear to be resetting A Pressed or B Pressed anywhere, so once triggered once they will indeed be locked on.
You are also using outputs from nodes in one event handler as inputs for a node in a different event handler, there are nodes you can share like this (āpureā functions and casts) which you probably donāt know about yet, a set node is not one such and if you are new to this I would just advise to avoid doing it altogether.
Fix those two issues like so, but with D substituted for B where appropriate
Timelines seem a bit messy here, I think you will have less problems (and a better result) using an RInterpTo or RInterpToConstant node with current rotation and a target rotation.
Thanks for the advice! What you showed does help with locking the Keys out, from being pressed while the other is. I didnāt release that, that is how you setup Set nodes.
However, Iād like to keep them locked until the player presses W, because while the locking you suggested prevents the jarring teleport during a press, it still jumps afterwards. Iām not too sure how to fix that issue.
And thank you for the suggestion on using RInterpTo and RInterpToConstant nodes instead.
The easy suggestion is of course do just set them both false on the W key handler⦠but I see you have two (which I did not notice before), and they both feed into timelines that update rotation. So you have another problem, when you press W both timelines will be playing (reverse) at the same time, one clobbering the results of the other.
With your current setup you would need to (somehow) remember which button was pressed (Was Button A/B Pressed, perhaps), set both existing flags to false, then branch on which button was selected before and take the true/false exec pins to the appropriate timeline.
It is about this time that I must recommend again you have a play with the RInterp functions and then re-implement this, going to make your life much easier!
Thanks so much for the advice and suggestions, Iāll play around with
RInterp functions some more, what Iāve been using has mostly been based off of what a tutorial had shown but had a few issues with what i was actually looking for so I had to try and edit it.
I was under the impression from you original post that the input disabling stuff you added was not really desirable, but needed to solve the rotation reset problem?
This was part of the reason I suggested using Interp functions instead of timelines, to make this easy to do without having to worry about the rotation reset (which admittedly could also be solved while still using timelines, just far less conveniently).
Your solution is still tracking button presses and disabling actions with those flags⦠is that something you actually want? Because you donāt need it now, you are always āstartingā from the current rotation (even when a rotation is in progress), so that original rotation reset problem does not exist anymore.