Switching use pawn control rotation on off jerks the camera

Hey everyone!

In my game, I have flying, and you can go back and forth between it and walking. When you fly, use pawn control rotation is turned off to lock the camera to the player, so that they rotate together. It turns back on when you walk.

The issue is that when you start flying(turn off pawn control rotation), it seems to remember the yaw rotation from right at that point, cause if you turn at all during flight, then stop flying and start walking (turn on pawn control rotation) the camera jerks back to where it was when you were walking before the flight. so basically, when you turn in flight, you can expect the camera to move back to where it was previously, disorienting the player.

I had a little fix temporarily that basically just readjusted the camera to the mesh direction, but you could see it jerk for a moment before adjusting in the right direction. I’m worried that this is just in the nature of use pawn control rotation. Is there a better option or a way to turn that off?

Thanks!

There is always the fix of lerping to goal position and clamping your goal position to a min and max offset from the current rotation and location values. That’s generally the fix for any camera jitters, just lower the lerp weight.

Hey, thanks for responding! Do you think it will help at all considering the use pawn control rotation node has the goal of rotating the camera back built into it? Gonna try, but I feel as though it might not listen and will jerk

Honestly, that’s a possibility. This is why clamping your lerp weight is important. This type of setup is going to require that your goal camera settings get stored and checked first before actually applying them to the camera. So, as to not interfere with any of your movement or other functionality, you can activate and deactivate your blending only when you’re switching modes. I used to have a blueprint for something like this but sorry the only thing I can really offer right now is a c++ version and hopefully you can take the logic from it and rebuild it in blueprints.

Smooth transition speed up and down from the camera’s current position



void ABFP_CameraPosition::UpdateLocationBlender()
{
	if (doBlendUpT){
		if ((blendTime + 0.5f) <= maxBlendSpeed){
			blendTime = (blendTime + 0.5f);
		}
		else{
			blendTime = maxBlendSpeed;
			doBlendUpT = false;
		}
	}
	else{
		if ((blendTime - 0.05f) >= minBlendSpeed){
			blendTime = (blendTime - 0.05f);
		}
		else{
			blendTime = minBlendSpeed;
		}
	}
}

//Lerp and RInterpolate



		//-------------------------------------------
		//Lerp camera Location
		//-------------------------------------------
		FVector newCamLocation = FMath::VInterpTo(gameCamera->GetActorLocation(), out_CamLoc, fDeltaTime, blendTime);

		gameCamera->SetActorLocation(newCamLocation);


		//Set Rotation
		FVector const targetV = FVector(centerP + FVector(0, 0, ((playerDist + 1) * 0.14145f)));
		
		rotationTarget = LookAt(gameCamera->GetActorLocation(), targetV);

		//-------------------------------------------
		//Lerp camera rotation
		//-------------------------------------------
		FRotator newCamRotation = FMath::RInterpTo(gameCamera->GetActorRotation(), rotationTarget, fDeltaTime, (blendTime * 2));
		gameCamera->SetActorRotation(newCamRotation);