Smooth player pawn as it pitches beyond +/- 90 degrees VIDEO

When I loop my Character/Pawn, if I’m applying yaw as it loops and goes beyond 90 degrees my plane flies in an S… not really a loop.


Here’s a VIDEO
To counter this, and allow a smooth loop, I tried multiplying pitch by -1 for when the aircraft is upside down. But as you can see, there is still a hitch at +/- 90 pitch (I don’t think it’s gimbal lock)


Here’s a VIDEO

Is there a better way to get smooth 360 rotation of a pawn?

I’m not entirely sure if this is the cause of the problem here, but there has long been an issue with character movement: Looking straight up/down messes with the calculations of where “forward” is. (I never actually checked the code, but I presume this is due to projecting the forward vector onto the floor, which doesn’t give you any direction for a vector perpendicular to the x-y-plane.)
In your case the change in the forward-vector direction upon looking up/down is likely to result in the calculations for the angular velocity being off, due to a sudden change in movement direction on the character.
If you are using the Character class, it might be best to switch to a Pawn and add required components (mesh, etc.) by hand. Otherwise you might have to edit the CharacterMovementComponent using C++. (Which I do not recommend to anyone)

If you already use a Pawn or the problem persists let me know and I’ll give this some more thought.

1 Like

Thank you @CrispClover :+1:

Yeah… I thought it might be the Character component too, so I switched to Pawn. It’s the same result. The videos you see are from a Pawn.

As far as I can tell, it’s how the ‘Add Controller Yaw’ is added.

  • When the aircraft is right side up: it will turn right relative to the ground
  • When the aircraft is upside down: it will still turn right relative to the ground (though the camera is also inverted). This is what gives the weird S-loop (in the first video) when yawing and going beyond +/- 90 degrees.


Here’s a VIDEO

Oh, I see! If you’re using “Use Controller Rotation Yaw” you could consider applying the rotation to the character directly instead. Alternatively you could try using “Combine Rotators” and “Set Control Rotation”, combining the local rotation and the rotation input and then applying the result. that should cause the yaw to smoothly adjust as the pitch changes. Let me know how things go.

1 Like

If you want your aircraft to rotate freely I suggest you look into quaternion rotation.

Here is something that could help: UE4 solves the problem of universal lock - Katastros


Quat

1 Like

@CrispClover and @pezotti… thank you both! :smiley:

CrispClover… Yeah, these are definitely options. It will need me to invest some time into it,hoping to find a solution as ‘native’ as possible.

Pezotti… It seems like a solid option. Regrettably, I don’t quite have the skills to implement a custom BP node in UE5. Hopefully someone will develop a quaternion plugin, just as there was for UE4