Description

The description of SpringArmComponent's "Use Camera Lag Substepping" option says "sub-step camera damping so that it handles fluctuating frame rates well". However, as noted and explained by a licensee on this UDN case (https://udn.unrealengine.com/s/case/500QP00000B76TmYAJ/bug-in-uspringarmcomponentupdatedesiredarmlocation-with-busecameralagsubstepping), it does not handle fluctuating frame rates correctly, which can cause noticeable judder.

In a correct implementation, using "Camera Lag Substepping" and setting "CameraLagMaxTimeStep" to "1/60" should make the camera behave as if the game was running at 60 fps, even if the actual frame rate is stable or fluctuating below that. However, in the current implementation (from UE 4.27 to UE 5.4), the calculated interpolation substep is not correct.

The licensee on the UDN case provided a solution that works well for the intended purpose on camera rotations, as analyzed mathematically and verified empirically by a UDN partner. A simplified-diff solution for both the rotation and location can be found in the repro project (please diff the provided MySpringArmComponent.h|.cpp with the built-in SpringArmComponent.h|.cpp on UE 4.27, the diff is nearly identical on later engine versions):

[Engine/Source/Runtime/Engine/Classes/GameFramework/SpringArmComponent.h]

  • Add variable "FVector PreviousTargetLoc;" after "FVector PreviousDesiredLoc;"
  • Add variable "FRotator PreviousTargetRot;" after "FRotator PreviousDesiredRot;"

[Engine/Source/Runtime/Engine/Private/GameFramework/SpringArmComponent.cpp]

  • In function "USpringArmComponent::UpdateDesiredArmLocation()", replace lines [91..171] with lines [91..176] from the repro project's MySpringArmComponent.cpp

 

Steps to Reproduce
  • Download repro project from: [Link Removed]
  • Compile and open in Editor
  • Test 1:
  • PIE
  • Move the camera up +-45 degrees (right mouse button + move mouse down)
  • Move the pawn left and right ('A' and 'D')
  • While moving, press 'Space' some times. This will cycle "t.MaxFPS" between {120,60,30,15}.
    - Note that, for each FPS, the visual position of the pawn on the viewport is different.
    - Rotate the pawn left and right ('left arrow' and 'right arrow')
    - While rotating, press 'Space' some times. This will cycle "t.MaxFPS" between {120,60,30,15}

    .

  • Note that, for each FPS, the visual rotation of the pawn on the viewport is different.
  • Test 2:
  • Delete "Pawn_SpringArm" from the scene (which uses the built-in "SpringArmComponent")
  • Add "Pawn_MySpringArm" to the scene (which uses the fixed-up "MySpringArmComponent")
  • PIE
  • Repeat test 1
  • Note that, for each FPS, the visual position and rotation of the pawn on the viewport is constant.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-216449 in the post.

1
Login to Vote

Unresolved
ComponentUE - Gameplay
Affects Versions5.44.275.05.15.25.3
Target Fix5.6
CreatedJun 4, 2024
UpdatedSep 30, 2024
View Jira Issue