Hey all,
So I’m currently working on a sky diving portion of my game that’s based off the Third Person project and I was wondering how to remove the gimbal lock on the camera. Right now the gimbal is fine for moving on the ground, but when free falling I want to remove the lock to allow the player to view/move without restriction. The current setup I’m using is:
// Create a camera boom (pulls in towards the player if there is a collision)
CameraBoom = PCIP.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom"));
CameraBoom->AttachTo(RootComponent);
CameraBoom->TargetArmLength = 100.0f; // The camera follows at this distance behind the character
CameraBoom->bUseControllerViewRotation = true; // Rotate the arm based on the controller
// Create a follow camera
FollowCamera = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FollowCamera"));
FollowCamera->AttachTo(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
FollowCamera->bUseControllerViewRotation = false; // Camera does not rotate relative to arm
The follow camera is of type UCameraComponent and when free falling I lerp the players movement in the direction of the camera so the players rotation follows the camera with a slight delay/smooth.
Is there a an easy way to do this or will I need to setup my own camera type inheriting from UCameraComponent?
Thanks in advance