Updated TempCharacter.cpp
Cached the camera reference isntead of constantly casting for it
This commit is contained in:
parent
81d926ffb3
commit
14c7d6b6d7
@ -24,6 +24,7 @@ void ATempCharacter::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
Health = 100;
|
||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||
}
|
||||
|
||||
//Binds the input we made in the setup player component to the forward vector
|
||||
@ -147,7 +148,6 @@ void ATempCharacter::InputDisabler()
|
||||
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = true;
|
||||
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = true;
|
||||
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = true;
|
||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||
if (ThisCamera == nullptr)
|
||||
{
|
||||
return;
|
||||
@ -173,7 +173,6 @@ void ATempCharacter::InputEnabler()
|
||||
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false;
|
||||
//GetWorld()->GetFirstPlayerController()->InputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed);
|
||||
TraceDistance = 300;
|
||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||
if (ThisCamera == nullptr)
|
||||
{
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user