# Twitching in Lerp rotation

**URL:** <https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [September 16, 2024, 8:00am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750 "2024-09-16T08:00:01Z")\
**Posts on this page:** 16\
**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:** [September 16, 2024, 8:00am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/1 "2024-09-16T08:00:01Z")

</div>

I’m really struggling with a (very) specific use case regarding control rotators.

My pawn always rotates freely in roll, pitch, yaw. However, my third person camera (standard, no lag spring arm) has two states:

1. Follow pawn in roll, pitch, yaw
2. Follow pawn only in yaw (roll and pitch are zero)

I’m (trying to) use Lerp to smoothly transition between the two states. Regrettably, **Rinterp** isn’t suitable, because it introduces lag. So I’ve tried the following Lerp techniques…

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/6/f/46fdfa3f8a8f33c5b4f15a765867caf17ec8b53b.png)

I’m not sure why (it’s under the hood somewhere), but none of the above options will give me a smooth interpolation.

With all of them, they’ll hitch in either one of two different and repeatable circumstance:

1. while the alpha is changing from 0 to 1, when quickly rotating the pawn, and it pitches to upside down facing the camera, and goes beyond this to a negative pitch (angles below the horizon).
2. while alpha is changing from 1 to 0, and the pawn was facing the camera it will glitch to quickly behind the camera.

The results look about the same, whether I use rotators or quats, and whether I apply normalization or not.

_PS. Vector interp included just for completeness, Smooth Movement plugin from is from Laird S on the Marketplace, and I’ve tried with the TLerp’s lerps options (quat, euler and dual quat)._

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 17, 2024, 8:39am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/2 "2024-09-17T08:39:44Z")

</div>

How does the camera only follow in Yaw? What is the ‘player experience’ supposed to be there?

Is there a spring arm at all, or is the camera just part of the pawn?

---

<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:** [September 17, 2024, 9:05am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/3 "2024-09-17T09:05:37Z")

</div>

Thank U @ClockworkOcean! Yes, it’s an uber-normal 3rd person character\>spring arm\>camera with no rotation lag. All the spring arm rotation inheritance is turned off, it’s set to ‘absolute rotation’ and it’s controlled as per the screenshot above (top right hand corner). I understand why U were confused, I was using spring arm and camera interchangeably 🙂

In state 0… like the pawn is flying… the spring arm follows the character’s full pitch, yaw, roll motion.

In state 1… like the pawn is driving… the spring arm follows the yaw only,

So, in the lerp, so pitch and roll should lerp smoothly to zero while yaw feeds through directly.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 17, 2024, 9:08am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/4 "2024-09-17T09:08:29Z")

</div>

So you wouldn’t go into state 1 while the player was in some convoluted roll maneuver?

They would need to right themselves roughly first?

---

<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:** [September 17, 2024, 9:11am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/5 "2024-09-17T09:11:52Z")

</div>

Excellent question, this is kind of the issue. In this game, it’s absolutely common that the player would roll/pitch/themselves from state 0 to 1 with convoluted rotations going on all the while. Like, imagine wildly chaotic landings being the norm and even in state 1 the pawn (but not spring arm) can quickly roll/pitch/yaw.

I initially thought it was that lerp just couldn’t ‘keep’ up, and who could blame it with all the gyrations?

But seeing how the twitch is uber-repeatable and lerp is 100 percent smooth otherwise, it seems to relate to the instant pitch switches from + to -

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 17, 2024, 9:19am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/6 "2024-09-17T09:19:38Z")

</div>

The thing is, with rotation, you often can’t separate the axes, it’s all one thing.

So you can’t extract the Z, unless the player is nearly upright ( X and Y \< 90 )

I think you will get some mileage by staying state 1, unless the player is nearly upright, then let them switch to state 0.

---

<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:** [September 17, 2024, 9:33am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/7 "2024-09-17T09:33:17Z")

</div>

Thank U! 🙂 Yeah, it may come to something like this. I’ll experiment with it more first, and put the results here.

It’s like the player is controlling a fast, indestructible rocket that flies (full following roll/pitch/yaw spring arm) and along the ground (pawn keeps full roll/pitch/yaw player control but lerps to a yaw-only spring arm so the camera won’t clip into the flat ground)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 17, 2024, 9:37am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/8 "2024-09-17T09:37:44Z")

</div>

I think you can do it, without it limiting things.

You can rinterp between both types if you do it carefully 🙂

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 17, 2024, 11:03am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/9 "2024-09-17T11:03:49Z")

</div>

This aligns with the actor rotation, unless it’s roll is \< 15, then it only copies Z

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/b/5/5b59a4d275924657f2911ba5ba2523ccdc468ae1.png)

![pawn rotation 2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/8/ce8b23ba2894456d3e5ca3fc3625e5827487a341.gif)

---

<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:** [September 17, 2024, 11:33am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/10 "2024-09-17T11:33:07Z")

</div>

Wonderful, @ClockworkOcean U are a treasure 🙂

I’d love to use Rinterp, but smoothing between both target pitches also introduces lag on yaw and roll (gah!)

I respect Ur valuable time and I think my use case is so specific, that I should just keep on it and post when I’ve figured it out.

I’m close, just solved the pitch +/- flipping. Now there is just one intermittent hitch that I can’t quite figure out the cause for.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 17, 2024, 11:43am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/11 "2024-09-17T11:43:21Z")

</div>

Yes, it can be very difficult to totally someone else’s pawn setup 😂 ( or requirements )

---

<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:** [September 18, 2024, 7:48am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/12 "2024-09-18T07:48:40Z")

</div>

It works perfectly, most of the time. There is occasionally a tiny speed up/yaw reversal as it goes to it’s final position in state 1 (on the ground)… I just don’t know why yet 🤔

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/e/3/2e3c83d35cbb96d1145469425d290ce4ba5b1521.png)

Here’s a shortcut to normalizing the control rotator. We do this so that it isn’t trying to interpolate 0 to 360 values the control rotator uses. Now all the values are +/- 180 in all 3 axes:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/7/7f72c9d88ae59f7dddc2570e9b4af781fb01d8d1.png)

We freeze the pitch and roll values at the start of going from state 0 to 1 (they aren’t needed) so this ‘Control Rotation Frozen’ eliminates the biggest hitch, when pitch goes negative as it goes into state 1.

Of the many lerping options available (image in the first post), I found the Lerp Transform set on ‘Quat Interp’ mode seems to be the most stable. I honestly don’t know why 🤔

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/4/4/544f0fe48172e3b6fe2d2b2a214173f367ca6365.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 18, 2024, 7:52am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/13 "2024-09-18T07:52:24Z")

</div>

Nice 🤩 I like the control normalization.

---

<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:** [September 18, 2024, 8:05am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/14 "2024-09-18T08:05:06Z")

</div>

Thank U @ClockworkOcean, Ur contribution to the community is awe-inspiring 🙏

I eventually figured out that **Actor Rotation** is not equal to **Control Rotation** or **Control Rotation Normalized** (3 different rotations formats under the BP hood) 🤪

[The 3 rotation formats in Blueprints - 1) Get Actor Rotation 2) Control Rotation 3) Normalized Rotation - Programming & Scripting / Blueprint - Epic Developer Community Forums (unrealengine.com)](https://forums.unrealengine.com/t/the-3-rotation-formats-in-blueprints-1-get-actor-rotation-2-control-rotation-3-normalized-rotation/1967946)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 18, 2024, 8:15am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/15 "2024-09-18T08:15:25Z")

</div>

Thank you 👍

I agree, BP users aren’t really protected from the more esoteric aspects of rotation… 🧐

---

<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:** [September 24, 2024, 10:54am UTC](https://forums.unrealengine.com/t/twitching-in-lerp-rotation/2022750/16 "2024-09-24T10:54:22Z")

</div>

Woooooo, I finally figured out what is causing the twitch.

Regrettably, it looks the **rotation lerp** converts the **normalized control rotation** to a **standard rotation** internally before the lerp takes place. It turns out that my earlier assumption that Rlerp would preserve the normalized control rotations at all axes at +/- 180 degree was incorrect. This is why, from certain angles in the 360 degree pawn rotation, the mashed rotation for the spring arm won’t lerp smoothly between states 0 and 1.

It’s not quite a bug, because my use case (mashing 3 Rinterps together to get spring arm lag that can vary on different axes… and then lerping the result) is unusual.

By themselves, the mashed 3 Rinterps work fine, because they preserve the format. Yes, I’m obsessed with figuring this out 🙂

My investigations into a solution continue!

[Applying different rotation lag to each axis of a spring arm - Programming & Scripting / Blueprint - Epic Developer Community Forums (unrealengine.com)](https://forums.unrealengine.com/t/applying-different-rotation-lag-to-each-axis-of-a-spring-arm/1967927/4)
