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.6) [stepism@UE4メモ]

ユーザ用ツール

サイト用ツール


wiki:ue4:tips:501

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_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

差分

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

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

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
wiki:ue4:tips:501 [2015/04/22 03:51]
127.0.0.1 外部編集
wiki:ue4:tips:501 [2015/04/27 22:26] (現在)
step
ライン 1: ライン 1:
-====== ​コンポネント追加(4.7.3) ======+====== ​アクターの回転(4.7.6) ======
  
-  - 「詳細パネル」「新規コンポネントの追加」から「新規C++コンポーネントの追加…」を選択する。 +回転ドに関してはここが詳しい。 
-  - 「ActorComponent」を選択して次へ進む。 +[[http://​historia.co.jp/​archives/​1820|[UE4] BlueprintのRotatorノードまとめ | historia Inc 株式会社ヒトリア]]
-  「MyActorComponent」など名前を付けて「クラを作成」する。+
  
  
-<sxh cpp; title: MyActorComponent.h>​ +===== ブループリントで対応する ===== 
-class STDPROJECT_API UMyActorComponent : public UActorComponent +{{:​wiki:​ue4:​tips:​ue4_actor_rotate01.png?​300|}}
-{ +
-    GENERATED_BODY()+
  
-private: +「Add Actor World Rotation」は現在地から相対的にYaw/Pitch/Rollで回転させることが出来ます。
-    ​// 追加 +
-    float m_fRunningTime;​ +
-+
-</​sxh>​+
  
-<sxh cpp; title: ​MyActorComponent.cpp> + 
-// 開始時に呼ばれる +===== C++で対応する ===== 
-void UMyActorComponent::InitializeComponent()+ 
 +<sxh cpp; title: ​MyActor.cpp> 
 +void AMyActor::Tickfloat DeltaTime ​)
 { {
-    Super::InitializeComponent();+    Super::TickDeltaTime ); 
 +     
 +    // 相対的に回転 
 +    AddActorWorldRotation(FRotator(0.0f,​ 1.0f, 0.0f));
 } }
  
-// 毎フレーム呼ばれる 
-void UMyActorComponent::​TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) 
-{ 
-    Super::​TickComponent( DeltaTime, TickType, ThisTickFunction ); 
- 
-    // 追加 
-    AActor* pOwner = GetOwner(); 
-    FVector NewLocation = pOwner->​GetActorLocation();​ 
-    float DeltaHeight = (FMath::​Cos(m_fRunningTime + DeltaTime) - FMath::​Cos(m_fRunningTime));​ 
-    NewLocation.X += DeltaHeight * 20.0f; 
-    m_fRunningTime += DeltaTime; 
-    pOwner->​SetActorLocation(NewLocation);​ 
-} 
 </​sxh>​ </​sxh>​
- 
-動作はCos移動するだけの物を実装してみました。プロジェクトをビルドしてエラーが出ないことを確認します。 
- 
-  - UE4エディターに戻って「MyActorComponent」を任意のアクターに割り当てます。 
-{{:​wiki:​ue4:​tips:​ue4_add_component.png|}} 
- 
-これで再生するとアクターが動くはずですが、もし動かない場合は「アクターの可動性」が「スタティック」になっているので、「ムーバブル」に変更します。 
- 
- 
-{{:​wiki:​ue4:​tips:​ue4_actor_movable.png|}} 
- 
- 
wiki/ue4/tips/501.1429674688.txt.gz · 最終更新: 2015/04/27 13:26 (外部編集)