BP: Airplane rotation; smooth transition between left and right rotation

Hello everyone,

I know the title isn’t an ideal description but I have no idea how to put it any clearer in a short manor. So let me explain in a bit more detail what my issue is. I can’t seem to wrap my head around a decent solution.

For clarification, some rules/restriction for what I’m trying to achieve.

  • I have an airplane that always needs to fly forward. Think, an endless runner where you always go forward.
  • Airplane should be able to go up and down.
  • Airplane should be able to go left and right.

Problem
I want the airplane to be controllable by keyboard. When pressing A, I want the airplane to rotate left and then move to the left. When pressing D, the airplane should rotate right and move to the right. When pressing none, the airplane should return to original rotation (so, no rotation).

So far so good, I made a timeline, on pressing A it turns, on release it returns to 0 rotation. I made a second timeline for D, splendid, it works. But here my problem becomes apparent, if the Timeline is not yet finished from A, and I press D, it cancels the first timeline so it rotates to 0 immediately and then starts the new timeline.

I do understand the problem, since the timeline starts at 0. But how do I fix my issue here?

Maybe timeline isn’t the way to go for me or maybe I should be using 1 timeline instead of 2 separate ones? Anyway, I hope you ladies and gentleman can help me get my thoughts on this back on track.

I would not use timeline for this. Also split your problem into 2 problems:

  • later on you probably want to make levels, follow plane some path etc. So first problem is how to make player pawn follow path
  • second problem is how to display plane like it is following that path (or around it).

For first problem:

  • create camera that follows path (for now just follow do not make it pan or move to the sides)
  • make pawn that is just a ball, steer that ball around path (use spline for it)

For second part:

  • calculate (remember in array of transforms or locations) where ball was sec ago and where it is now
  • rotate plane to align with those 2 points
  • add plane animations like barell rolls etc.

You can use (Vinterp to) for location and (Rinterp to) for rotation. Look on YouTube for tutorials. For example, when you want to rotate back you need to get your current rotation plugged in current and the final rotation plugged in target.


for the target

1 Like

Thank you for your reply. For now it’s not the exact thing I want to go for but it’s a good fallback option.

I will look into this, thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.