Warning: Declaration of action_plugin_linebreak::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /home/stepism/www/ue4/wiki/lib/plugins/linebreak/action.php on line 41

Warning: Declaration of action_plugin_markdownextra::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /home/stepism/www/ue4/wiki/lib/plugins/markdownextra/action.php on line 16

Warning: Declaration of action_plugin_syntaxhighlighter3_action::register(Doku_Event_Handler &$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /home/stepism/www/ue4/wiki/lib/plugins/syntaxhighlighter3/action/action.php on line 28
割り当てたキーに処理を割り当てる(4.7.5) [stepism@UE4メモ]

ユーザ用ツール

サイト用ツール


wiki:ue4:input:002

以前のリビジョンの文書です —-


Warning: Declaration of syntax_plugin_linebreak::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /home/stepism/www/ue4/wiki/lib/plugins/linebreak/syntax.php on line 52

Warning: Declaration of syntax_plugin_linebreak::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /home/stepism/www/ue4/wiki/lib/plugins/linebreak/syntax.php on line 74

Warning: Declaration of syntax_plugin_markdownextra::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /home/stepism/www/ue4/wiki/lib/plugins/markdownextra/syntax.php on line 38

Warning: Declaration of syntax_plugin_markdownextra::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /home/stepism/www/ue4/wiki/lib/plugins/markdownextra/syntax.php on line 47

Warning: Declaration of syntax_plugin_syntaxhighlighter3_syntax::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /home/stepism/www/ue4/wiki/lib/plugins/syntaxhighlighter3/syntax/syntax.php on line 53

Warning: Declaration of syntax_plugin_syntaxhighlighter3_syntax::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /home/stepism/www/ue4/wiki/lib/plugins/syntaxhighlighter3/syntax/syntax.php on line 82

割り当てたキーに処理を割り当てる(4.7.5)

キーの割り当てについて(4.7.5)で割り当てたキーに対して、処理を割り当ててみます。

ブループリントで対応する

C++で対応する

まず、割り当てる関数を準備しておきます。

void AMyPawn::MoveX(float AxisValue) 
{ 
    UE_LOG(LogTemp, Log, TEXT("AMyPawn::MoveX() called")); 
} 
 
void AMyPawn::MoveY(float AxisValue) 
{ 
    UE_LOG(LogTemp, Log, TEXT("AMyPawn::MoveY called")); 
} 
 
void AMyPawn::StartScaling() 
{ 
    UE_LOG(LogTemp, Log, TEXT("AMyPawn::StartScaling called")); 
} 
 
void AMyPawn::StopScaling() 
{ 
    UE_LOG(LogTemp, Log, TEXT("AMyPawn::StopScaling called")); 
} 

次に、ポーンクラスのSetupPlayerInputComponent等で、アクション(関数)を割り当てます。

void AMyPawn::SetupPlayerInputComponent(class UInputComponent* InputComponent) 
{ 
    Super::SetupPlayerInputComponent(InputComponent); 
 
    // 拡縮 キーアクション割り当て 
    InputComponent->BindAction("Scale", IE_Pressed, this, &AMyPawn::StartScaling);	// 押した時 
    InputComponent->BindAction("Scale", IE_Released, this, &AMyPawn::StopScaling);	// 離した時 
 
    // 移動キーアクションの割り当て 
    InputComponent->BindAxis("MoveX", this, &AMyPawn::MoveX); 
    InputComponent->BindAxis("MoveY", this, &AMyPawn::MoveY); 
} 

これで、割り当てた関数が呼ばれる様になります。

既知の問題

  • BindActionに E_Repeat を指定すると関数が呼ばれない。

押しっぱなし判定について

  • ボタンアクションにE_Repeatが使えないので、フラグを用いて代替え案。
bIsDown = true; 
 
void AMyPawn::Tick( float DeltaTime ) 
{ 
    Super::Tick( DeltaTime ); 
 
    // 押しっぱなし判定 
    if (bIsDown) 
    { 
    	UE_LOG(LogTemp, Log, TEXT("bIsDown")); 
    } 
} 
 
void AMyPawn::StartScaling() 
{ 
    bIsDown = true; 
} 
 
void AMyPawn::StopScaling() 
{ 
    bIsDown = false; 
}
wiki/ue4/input/002.1429619291.txt.gz · 最終更新: 2015/04/21 12:45 (外部編集)