如何設置才能判定按鍵是否按住
小弟的目標是打算做到按下shift鍵,移動就變成跑步但目前卡在一個地方,就是不能判定shift鍵按住放開
小弟的碼是這樣的
void AARPGCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
InputComponent->BindAction("Run", IE_Pressed, this, &AARPGCharacter::StartRunning);
InputComponent->BindAction("RunToggle", IE_Pressed, this, &AARPGCharacter::RunningToggle);
InputComponent->BindAction("Run", IE_Pressed, this, &AARPGCharacter::StopRunning);
}
void AARPGCharacter::StartRunning()
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("開始跑步runing"));
}
void AARPGCharacter::StopRunning()
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("停止跑步 StopRunning"));
}
但變成我按shift鍵就同時跑出
開始跑步
停止跑步
想問一下如何設定按下Shift鍵,就先出現「開始跑步」
放開Shift鍵,就先出現「停止跑步」
松开是IE_Released 感謝說明
一改就成功了,就下來小弟就知道作麼做了
页:
[1]