인풋 처리하기

This commit is contained in:
강민제 2025-04-24 00:58:47 +09:00
parent aa77cd9716
commit 9d78f53ba3
4 changed files with 17 additions and 13 deletions

View File

@ -37,11 +37,3 @@ void ABasePawn::Tick(float DeltaTime)
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void ABasePawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}

View File

@ -35,8 +35,5 @@ private:
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
};

View File

@ -14,3 +14,14 @@ ATank::ATank()
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
Camera->SetupAttachment(SpringArm);
}
void ATank::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis(TEXT("MoveForward"), this, &ATank::Move);
}
void ATank::Move(float Value)
{
UE_LOG(LogTemp, Warning, TEXT("Move: %f"), Value);
}

View File

@ -16,6 +16,9 @@ class TOONTANKS_API ATank : public ABasePawn
public:
ATank();
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
@ -23,5 +26,6 @@ private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
class UCameraComponent* Camera;
void Move(float Value);
};