I’ve been on this for days, and the following is the best I’ve come up with. But it’s awfully hacky, there must be better and simpler solutions. The BP here works, but it’s clunky as heck. There is a video of the ideal behavior here:
Imagine an arcade-style flying superhero game where the player controls the character with a gamepad. The top left and right shoulder buttons control roll left and right in 180-degree increments.
As viewed from behind the character, the top right shoulder button rolls it clockwise, and the top left shoulder button rolls it anticlockwise. For example:
one right click – character rolls clockwise to 180 degrees (upside down)
second right click – character continues to roll clockwise to 0 degrees/360 degrees (rightside up)
and the loop repeats
The top left shoulder button does exactly the same thing, but just rolls anticlockwise.
However, there is a minor complication, when buttons are pressed while the character is already rolling. For example:
While the character is in the process of rolling right/clockwise (driven by the timeline, it takes about a second):
if the player clicks the right button a second time – the instruction should be completely ignored
if the player clicks the left button – the character should stop rolling clockwise and roll anticlockwise back to where the right roll was initiated
And while the character is in the process rolling left/anticlockwise (driven by the timeline, it takes about a second):
if the player clicks the left button a second time, the instruction should be completely ignored
if the player clicks the left button, it sold stop rolling anticlockwise and roll clockwise back to where the left roll was initiated
In the video and the BP, everything behaves as intended… but I know there’s a more elegant way to do it.
To streamline your game’s character roll controls, consider implementing a state machine. This will manage the character’s states and transitions between them, ensuring smooth and non-conflicting movements. It’s a cleaner approach than multiple condition checks and will handle complex input scenarios more elegantly. destiny card
@MarkK1124 Thank you Mark, but I think you are talking about animation states? This is more about pawn control rotation, specifically in the roll axis.
Hi David, I finally got it. I think this is what you wanted. Pressing the shoulder buttons one time and having the character rotate smoothly 180 degrees and stop. You were on the right track with timelines (something I actually don’t use much). I teamed them up with Enums and FInterpTo and a boolean to achieve the effect you are after.
@usa423 Thank you! I’m astonished you went so far above and beyond! Respect!
I spent a ludicrous amount of time on this and made a few changes to the original approach. I favor using a Timeline (and staying off Tick) because it is very performant:
everything only executes when the timeline is running (takes about 1 second)
most of the nodes execute just once with InputAction, DoOnce and TimelineFinished
it’s simple and in one location
I’m 100 percent sure there is a more elegant way to do this. Please feel free to suggest! But what’s here is workable.