Problems with SpringArmComponent's bInheritYaw

I have a PlayerCharacter class that uses a camera on a springarm, which the springarm inherits the player’s yaw by default. I set bUsePawnControlRotation = true, bInheritYaw = true and the other two axes = false.
My problem is, that the character has an ability, during which I want the camera to be freely movable, so my code sets bInheritYaw = false when the ability is toggled on and back to true when it is toggled off. But the moment bInheritYaw is set to false, the springarm snaps to world rotation { 0.f, 0.f, 0.f } instead of keeping it’s current world rotation.

Is there a way to prevent this from happening in the first place? I could probably work out a way to rotate the camera back to it’s previous position afterwards but I would like it to just stay in position.

The solution is to use

YourSpringArmComponent->SetRelativeRotation(YourSpringArmComponent->GetTargetRotation())

on the springarm before setting bInheritYaw = false

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.