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

差分

この文書の現在のバージョンと選択したバージョンの差分を表示します。

この比較画面にリンクする

次のリビジョン
前のリビジョン
wiki:ue4:input:002 [2015/04/21 12:28]
127.0.0.1 外部編集
wiki:ue4:input:002 [2015/04/22 06:54] (現在)
ライン 2: ライン 2:
  
 [[wiki:​ue4:​input:​001]]で割り当てたキーに対して、処理を割り当ててみます。 [[wiki:​ue4:​input:​001]]で割り当てたキーに対して、処理を割り当ててみます。
 +ここでは仮にMyPawnクラスを用意してログを出力するだけの物を実装します。
  
 ===== ブループリントで対応する ===== ===== ブループリントで対応する =====
 +MyPawnブループリントの中身はこんな感じになっています。
  
 +{{:​wiki:​ue4:​input:​ue4_input_action_bind_test.png?​300|}}
 +
 +赤いノードが入力結果を受け取りイベントを発行し、各種関数を呼び出しています。
 +
 +押しっぱなし判定はこんな感じ。
 +{{:​wiki:​ue4:​input:​ue4_input_hold_key.png?​300|}}
  
  
ライン 10: ライン 18:
  
 まず、割り当てる関数を準備しておきます。 まず、割り当てる関数を準備しておきます。
-<code csharp>+<sxh cpp; title: MyPawn.cpp>
 void AMyPawn::​MoveX(float AxisValue) void AMyPawn::​MoveX(float AxisValue)
 { {
ライン 30: ライン 38:
     UE_LOG(LogTemp,​ Log, TEXT("​AMyPawn::​StopScaling called"​));​     UE_LOG(LogTemp,​ Log, TEXT("​AMyPawn::​StopScaling called"​));​
 } }
-</code>+</sxh>
  
  
 次に、ポーンクラスのSetupPlayerInputComponent等で、アクション(関数)を割り当てます。 次に、ポーンクラスのSetupPlayerInputComponent等で、アクション(関数)を割り当てます。
-<code cpp>+ 
 +<sxh cpp; title: MyPawn.cpp>
 void AMyPawn::​SetupPlayerInputComponent(class UInputComponent* InputComponent) void AMyPawn::​SetupPlayerInputComponent(class UInputComponent* InputComponent)
 { {
ライン 47: ライン 56:
     InputComponent->​BindAxis("​MoveY",​ this, &​AMyPawn::​MoveY);​     InputComponent->​BindAxis("​MoveY",​ this, &​AMyPawn::​MoveY);​
 } }
-</code>+</sxh>
  
 これで、割り当てた関数が呼ばれる様になります。 これで、割り当てた関数が呼ばれる様になります。
  
  
-====== 既知の問題 ​======+==== 既知の問題 ====
   * BindActionに E_Repeat を指定すると関数が呼ばれない。   * BindActionに E_Repeat を指定すると関数が呼ばれない。
  
-====== 押しっぱなし判定について ​======+==== 押しっぱなし判定について ====
   * ボタンアクションにE_Repeatが使えないので、フラグを用いて代替え案。   * ボタンアクションにE_Repeatが使えないので、フラグを用いて代替え案。
  
-<code csharp>+<sxh cpp; title: MyPawn.cpp>
 bIsDown = true; bIsDown = true;
  
ライン 82: ライン 91:
 } }
  
- +</sxh>
-</code>+
  
  
wiki/ue4/input/002.1429619291.txt.gz · 最終更新: 2015/04/21 12:45 (外部編集)