Add Torque in Pitch & Yaw, is causing Roll too... World/Local Space

Hi fellow devs :wink:

Because it seems noticeably smoother, I’m considering switching from Use Control Rotation to Add Torque for rotating my player Character in pitch and yaw (up/down, right/left)…without causing roll… I’ve tried using:

  • world space
  • local space
  • combined

But everything that I try seems to cause the player to roll… is there a better way? Thank you!

[click here for YouTube video][1]

I had the same issue in one of my projects before but then I used AddActorWorldRotation node, so I just replaced it with GetActorRotation and SetActorRotation and the issue was gone

thank you @Niyo_official :slight_smile: I know what you are saying… it’s true there are a bunch of ways (including the two forms of Control Rotation in the default Character setup… one in base of the Character actor and the second in the Character component itself), etc… but there is a certain smoothness that comes from Add Torque that I really like… so if there is a way, I’d like to use it.

I wouldn’t use torque for that unless you absolutely must have physics simulation - torque is notoriously fiddly to work with. I recently wrote a PID controller and while it kind of works fine, it’s still a wee bit off.


Why not rInterp to target rotation? It will be buttery smooth, give you plenty of fine granular control over the curve and you can even sample an external curve if you’re not happy with the built-in Ease functions.

@Everynone… thank you for this… using Rinterp definitely IS smoother. However, when I rotate my pawn past +/-90 in pitch the player pawn wobbles wildly :slight_smile:

I’ve attached a snapshot of this setup here.

If I plug Get Control Rotation directly in (without Rinterp) it will correctly rotate freely on all axes, so it looks like the issue is in the interpolation (or the difference in the UE4 rotation format between Get Actor Rotation and Get Control Rotation… as you know there are slight differences though usually the engine translates between them just fine).

Gimbal Lock - have a look here:

@Everynone… you are completely right about gimbal lock of course… thank you :slight_smile:

I’ve implemented the 7 new quaternion rotation BP functions. But I haven’t figured out how to Rinterp from Get Actor Rotation to Control Rotation using Set Actor Rotation.

As you know, Nebula Games’ youtube video uses a slightly different technique: Add Actor Local Rotation Quat. So… to get the smoothing benefit of Rinterp… I modified it like the image below… regrettably it still causes that gimbal lock flickering… I guess the lock takes place in the Rinterp function.