RInterpTo with UpdateBasedRotation

I’m using a custom gravitymod from pull 1773 with some of my own code thrown in. I’ve thrown this on top of the Shootergame example and currently I have a working 1st person shooter game with Custom gravity.

The problem I have, is that I can’t get the UpdateBasedRotation camera updating clunkiness to stop. To clarify the problem: I have small planets I walk on, that update the player’s gravity direction each tick. Walking to whichever direction updates the players basecomponent in my CharacterMovementComponent, which then calls the UpdateBasedRotation, which calls MyPlayerController::SetControlRotation. This keeps the character’s view the same in relation to the planet as it was. However the update is quite large (a few degrees per each step on the small planets) which results in the view “jumping” those few degrees.

I modified the UpdateBasedRotation function to have a RInterpTo as such:

Controller->SetControlRotation(FMath::RInterpTo(ControllerRot, ControllerRot + ReducedRotation, GetWorld()->GetDeltaSeconds(), 0.1f));

That should work, right? Well it doesn’t. The camera still jumps. Maybe I’m missing the obvious here and modifying the wrong function? I thought I tracked the “jumpiness” here, but maybe it’s somewhere else? Any ideas anyone?

Would it maybe help to use a spring arm for your camera and use the lag settings to prevent popping?

Well that was an easy solution!

Thanks again rcdarcey!

Fixed by rcdarcey’s suggestion:

Added a springarm component and enabled camera lag.

thanks! converted my comment to an answer, if you wanna check that :wink: