How to interpolate rotations

I’m trying to make a flying drone move such that it tilts to a certain angle of about 45 degrees and then continues to move linearly in the direction of rotation until the button is released. I’ve managed to make it do that, but instead of it just snapping straight from 0 to 45 I’d like it to tilt more smoothly, but I don’t really know what to use as the input for either alpha in Lerp(rotator) or DeltaTime in RinterpTo. Which of these two functions is better for the intended purpose, and what can I use for the mentioned variables?

https://drive.google.com/open?id=1eIDU0GAG-8ck5DzNWNmID2Zbo3k3t4tF

I’ve attached a link to the video of how I would like my drone to move.

You’ll notice that the turn motion is quite immediate, but then slows down as it approaches the desired angle. To get that graceful sort of panning motion, you need to use interp.

To use interp sucessfully you need some essential ingredients ( whatever kind of interp it is ):

  1. Current = a node which is feeding back the current position / value

  2. Target = a fixed value to which you want to move

  3. Delta time, which either comes from the EventTick node, or the node GetWorldDeltaSeconds

  4. The speed your want the interpolation to happen at. Personal preference.

Notice that 1 and 2 is where most people slip up. Also the whole collection of nodes controlling the turn must be on EventTick.

Thanks a lot for the reply :). That’s actually exactly where I get confused. I’m a bit new to Unreal, so I just connected the event tick to one node and then connected the rest in sequence. I want to enable this kind of movement for both the front-back and left-right movements so I didn’t really know how to connect it to them both. I only want a rotation of 45 degrees which I set along the y-axis for the front-back movement. It only moves if I click the input button repeatedly, but I need it to rotate for as long as I hold the button down till it reaches the target rotation.

In the first blueprint here I just tried it out for the forward direction, the second blueprint is only for blade movements so not very important. Is there something I need to change?

Other people’s tick blueprint are always a nightmare. I just quickly checked yours :slight_smile:

Start simply. Do one axis at a time. When you press the key, a target of ‘current angle + required amount’ should be set.

Then on tick, like I explained above, just interp using

node sampling current rotation ( that you’re attempting to change )
fixed point ( calculated above )

You can do all axes on tick, you just do them one at a time:

Tick → calculate target → interp for something → calculate another target → interp for another thing

Like that…

EDIT: Of course you can combine them when it’s rotation, or location for that matter.

If you can’t get it working come back.

Thanks a lot for the help! I just didn’t really know how to use the tick which is why I wasn’t able to get it to work, I tried the rinterpto function on a different object and it worked fine, so I think there could also be something else in the blueprint which stops it from moving the right way. For now I’ve just slightly changed it so that it makes very small increments in a loop.

By combining rotation and location, do you mean a transform?

Yes, the combo of scale, rotation and location is called transform.

If you wanna put the BP up here I’ll take a look

It’s only for one input that I’ve tried the interpolation in this case.

Do you mean the bit floating off to the left?

It’s only ok to have those zeros on current if that’s what’s really happening.

And you need a fixed target, so you can’t have the target related to the current.

Yes the part on the left. I had a doubt it wouldn’t work cos I wasn;t sure if the interpolation works as a world or a local rotation. So in that case I have to take the whole vector instead of splitting it.

Excellent :slight_smile:

Here’s an example of targeting using interp on tick, notice I set the target outside the tick:

301903-tilt.gif

EDIT: Interp doesn’t care about world or local, it’s just numbers to it.

Thank you so much! I’ve finally got it! I just wasn’t able to understand how event tick worked, but that’s clear now. Thanks a lot again :slight_smile: