Hi!
I’ve been extending on the Simple Shooter, and I’ve now got working Zoom in / Out and Sprint/StopSprinting functions, but I would like to disable the Zoom while Sprinting. I have set a new FOV when we enter sprint in case we were already zoomed in, but halfway through the sprint you can just press zoom again and it will zoom in. I want to disable the zoom entirely during sprint.
I figured this would be the easiest solution:
void AShooterCharacter::Sprint()
{
GetCharacterMovement()->MaxWalkSpeed *= SprintSpeedMultiplier;
IsCharacterSprinting = true;
int NewFOV = 90;
CameraComp->SetFieldOfView(NewFOV);
// Disable Zoom input.
PlayerInputComponent->RemoveActionBinding("Zoom", IE_Pressed);
}
void AShooterCharacter::StopSprinting()
{
GetCharacterMovement()->MaxWalkSpeed /= SprintSpeedMultiplier;
IsCharacterSprinting = false;
int NewFOV = 90;
CameraComp->SetFieldOfView(NewFOV);
// Enable Zoom input.
PlayerInputComponent->BindAction(TEXT("Zoom"), EInputEvent::IE_Pressed, this, &AShooterCharacter::ZoomIn);
}
The error I’m getting is:
D:\Projects\simpleshooter_extended\Source\SimpleShooter\ShooterCharacter.cpp(152): error C2065: ‘PlayerInputComponent’: undeclared identifier.
I have no idea how to access the PlayerInputComponent where all the ActionBindings live.
Hope you can point me in the right direction, or a hint where I should be looking for a proper implementation.
Thanks for taking a look!