# How to roll a flying character right and left, in 180 degree increments

**URL:** <https://forums.unrealengine.com/t/how-to-roll-a-flying-character-right-and-left-in-180-degree-increments/1865699>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [May 21, 2024, 3:29am UTC](https://forums.unrealengine.com/t/how-to-roll-a-flying-character-right-and-left-in-180-degree-increments/1865699 "2024-05-21T03:29:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidOConnor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidoconnor/32/978533_2.png) [@DavidOConnor](https://forums.unrealengine.com/u/DavidOConnor)\
**Post date:** [May 21, 2024, 3:29am UTC](https://forums.unrealengine.com/t/how-to-roll-a-flying-character-right-and-left-in-180-degree-increments/1865699/1 "2024-05-21T03:29:12Z")

</div>

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:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/e/7/8e7e6114e7e4eafbbcf634e24411ed6e294b9d12.jpeg "21 May 2024") ](https://www.youtube.com/watch?v=KyRd4EUS030)

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/c/03c2c7f2d4786fc8952ee6c7738999c0c641fe6d.jpeg)

---

<div class="post-metadata">

**Author:** ![MarkK1124](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MarkK1124](https://forums.unrealengine.com/u/MarkK1124)\
**Post date:** [May 21, 2024, 5:34am UTC](https://forums.unrealengine.com/t/how-to-roll-a-flying-character-right-and-left-in-180-degree-increments/1865699/2 "2024-05-21T05:34:40Z")

</div>

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](https://www.mydestiny-card.com)

---

<div class="post-metadata">

**Author:** ![DavidOConnor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidoconnor/32/978533_2.png) [@DavidOConnor](https://forums.unrealengine.com/u/DavidOConnor)\
**Post date:** [May 21, 2024, 5:43am UTC](https://forums.unrealengine.com/t/how-to-roll-a-flying-character-right-and-left-in-180-degree-increments/1865699/3 "2024-05-21T05:43:51Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![usa423](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/usa423/32/918773_2.png) [@usa423](https://forums.unrealengine.com/u/usa423)\
**Post date:** [May 23, 2024, 3:38am UTC](https://forums.unrealengine.com/t/how-to-roll-a-flying-character-right-and-left-in-180-degree-increments/1865699/4 "2024-05-23T03:38:10Z")

</div>

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.

 ![CameraActor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/0/d1087744408d2d899c0b7293ef35f18279042813.jpeg)  
 ![LevelBP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/6/426326533b14bbea42cc1c80875d34dd9438b018.jpeg)

 ![Image5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/7/6/2764e003bb00de3192d97a75933dce062504df26.jpeg)  
 ![Image6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/e/5/2e50612a8fb4c8116347211359233cf91c28f8ab.jpeg)  
 ![Image7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/9/869af9b5988340604d63fada6ed9f025d3043a17.jpeg)  
 ![Image8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/c/c4c42b00a521835c98dc5b10168150bf982ccc87.jpeg)

Here is you a project file you can study. Also with ShipScroller logic, I could make a Starfox like game with this.

[https://file.io/d1WbALqhpLZX](https://file.io/d1WbALqhpLZX)

If you have any questions let me know, hope this helps 🙂

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/1/8/31819b281ac475956101e89412e1c0d7a68cdb76.webp "Rotating180desgreesmoothlywithoneinputpress") ](https://vimeo.com/949392018)

---

<div class="post-metadata">

**Author:** ![DavidOConnor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidoconnor/32/978533_2.png) [@DavidOConnor](https://forums.unrealengine.com/u/DavidOConnor)\
**Post date:** [May 24, 2024, 7:10am UTC](https://forums.unrealengine.com/t/how-to-roll-a-flying-character-right-and-left-in-180-degree-increments/1865699/5 "2024-05-24T07:10:26Z")

</div>

@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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/a/59a4e9b081fdf8a3752ff37c2410d030761c8372.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/e/d/dedb599a0dd124651507c0722feb464a75094a1c.png)

---

<div class="post-metadata">

**Author:** ![DavidOConnor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidoconnor/32/978533_2.png) [@DavidOConnor](https://forums.unrealengine.com/u/DavidOConnor)\
**Post date:** [May 25, 2024, 6:34am UTC](https://forums.unrealengine.com/t/how-to-roll-a-flying-character-right-and-left-in-180-degree-increments/1865699/7 "2024-05-25T06:34:22Z")

</div>

@Claudiogaa Regrettably, another spamming bot.

Here’s a slightly better version…

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/5/665ce42021c7e4659f0a873f89c9bdea31784174.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/a/8/0a80da17fbaf49b9cbe9f94b77e80bc0778faadb.png)

---

<div class="post-metadata">

**Author:** ![DavidOConnor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidoconnor/32/978533_2.png) [@DavidOConnor](https://forums.unrealengine.com/u/DavidOConnor)\
**Post date:** [May 25, 2024, 8:06am UTC](https://forums.unrealengine.com/t/how-to-roll-a-flying-character-right-and-left-in-180-degree-increments/1865699/8 "2024-05-25T08:06:08Z")

</div>

Thank heaven! Finally, I figured it out. It’s a more reliable, simpler, and performant approach.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/f/7/ef721ea355ffed5cb00dfc83e2638203236132c9.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/9/47905536003bf4b49d520237a1b1b225da0d3a39.png)

There are just a couple of gotchas _inside_ the timeline itself:

- it’s set to ‘Looping’
- mine 2 is seconds long (ymmv, just remember to update the stop points and checks accordingly)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/5/6/f56eeaf7c2f8471a646d25c9c54c4a866c7c86d5.png)
