Twitching in Lerp rotation

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…

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

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?

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 :slight_smile:

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.

1 Like

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?

1 Like

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 -

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.

1 Like

Thank U! :slight_smile: 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)

1 Like

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

You can rinterp between both types if you do it carefully :slight_smile:

1 Like

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

pawn rotation 2

1 Like

Wonderful, @ClockworkOcean U are a treasure :slight_smile:

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.

1 Like

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

1 Like

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 :thinking:

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:

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 :thinking:

1 Like

Nice :star_struck: I like the control normalization.

1 Like

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

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) :crazy_face:

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)

1 Like

Thank you :+1:

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

1 Like