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
wiki:ue4:tips:500 [stepism@UE4メモ]

ユーザ用ツール

サイト用ツール


wiki:ue4:tips:500

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

差分

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

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

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
wiki:ue4:tips:500 [2015/04/24 04:01]
127.0.0.1 外部編集
wiki:ue4:tips:500 [2016/03/06 10:32] (現在)
step
ライン 1: ライン 1:
-====== アクターの移動(4.7.5) ====== +投稿は再構築して移動しまし。 
- +[[wiki:tips:006|http://stepism.sakura.ne.jp/ue4/wiki/doku.php?id=wiki:tips:006]]
-[[https://​docs.unrealengine.com/​latest/​JPN/​Programming/​QuickStart/​index.html|Unreal Engine | プログラマ向けクイックスタート]] +
-を参考にして上下移動するアクター実装します。 +
- +
- +
-===== ブループリントで対応する ===== +
-  -「コンテンツブラウザ」の「新規追加」から「Blueprints クラス」を選択する。 +
-  - 親クラスに「Actor」を選択て名前を「MyActor」にリネーム。 +
-  - MyActorをダブルクリックで編集画面を開く。 +
- +
-{{:wiki:ue4:tips:ue4_bp_editor.png?​300|}} +
- +
- +
-ブループリントエディター。EventGraphタブを開いておく。 +
- +
-==== ブループリントの編集 ==== +
- +
-変数を追加する。 +
-{{:​wiki:​ue4:​tips:​ue4_add_variable.png?​300|}} +
- +
- +
-処理を追加する。 +
-{{:​wiki:​ue4:​tips:​ue4_sin_move_sample.png?​300|}} +
- +
-「Add Actor World Offset」 で相対的に座標移動出来る。 +
-Vector型は右クリックから「構造体ピンを分割」してxyz各種パラメータにアクセスできる。 +
-[[http://unrealengine.hatenablog.com/​entry/​2014/​12/​04/​231253|UE4 ブループリントで構造体の値を楽に渡す方法 - Let's Enjoy Unreal Engine]] +
- +
- +
-\\ +
-\\ +
- +
-===== C++で対応する ===== +
-  - 「コンテンツブラウザ」の「新規追加」から「新規C++ Class...」を選択する。 +
-  - 親クラスに「Actor」を選択して次へ。 +
-  - 名前を「MyActor」として「クラスを作成」する。 +
- +
-==== コードの記述とコンパイル ==== +
-  - クラスが生成されると自動でVisual Studioが開くので、MyActor.h/cppを編集します。 +
- +
- +
-変数を追加する。 +
-<sxh cpp; title: MyActor.h>​ +
-class STDPROJECT_API AMyActor : public AActor +
-+
-    GENERATED_BODY() +
-private: +
-    ​// 追加 +
-    float RunningTime;​ +
-+
-</​sxh>​ +
- +
-処理を追加する。 +
-<sxh cpp; title: MyActor.cpp> +
- +
-// コンストラクタ +
-AMyActor::​AMyActor() +
-+
- PrimaryActorTick.bCanEverTick ​true; +
-  +
- RunningTime = 0.0f; +
- +
- // ダミーのルートコンポーネント作成 +
- RootComponent = CreateDefaultSubobject<​USceneComponent>​(TEXT("​RootComponent"​));​ +
-+
- +
-// 毎フレーム呼ばれる +
-void AMyActor::​Tick( float DeltaTime ) +
-+
- Super::​Tick( DeltaTime ); +
- +
- float DeltaHeight = (FMath::​Sin(RunningTime + DeltaTime) - FMath::​Sin(RunningTime));​ +
- +
- // 相対的に移動させる +
- AddActorWorldOffset( FVector( 0, 0, DeltaHeight * 20.0f )); +
- +
- RunningTime += DeltaTime;​ +
-+
- +
-</​sxh>​ +
- +
-プロジェクトをビルドしてエラーが出ないことを確認します。 +
- +
-===== Actorを配置する ===== +
-  - UE4エディターに戻って「コンテンツブラウザ」から「MyActor」をビューポートにドラッグ&ドロップする。 +
-  - 「ワールドアウトライナー」に「MyActor1」が追加されアクターの詳細が設定できる様になります。 +
-  - 「MyActor1」の「詳細パネル」の「コンポーネントを追加」から適当な図形を選択します。ここでは球(Sphere)を選択。 +
- +
-{{:wiki:ue4:tips:ue4_create_actor_shpere.png|}} +
- +
-これでビューポートにアクターが表示されました。 +
-実行すると上下にSin移動します。+
wiki/ue4/tips/500.1429848102.txt.gz · 最終更新: 2016/03/06 10:32 (外部編集)