以前のリビジョンの文書です
—-
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)
ブループリントで対応する
「コンテンツブラウザ」の「新規追加」から「Blueprints クラス」を選択する。
親クラスに「Actor」を選択して名前を「MyActor」にリネーム。
MyActorをダブルクリックで編集画面を開く。
ブループリントエディター。EventGraphタブを開いておく。
ブループリントの編集
C++で対応する
「コンテンツブラウザ」の「新規追加」から「新規C++ Class…」を選択する。
親クラスに「Actor」を選択して次へ。
名前を「MyActor」として「クラスを作成」する。
コードの記述とコンパイル
クラスが生成されると自動でVisual Studioが開くので、MyActor.h/cppを編集します。
変数を追加する。
class STDPROJECT_API AMyActor : public AActor
{
GENERATED_BODY()
private:
// 追加
float RunningTime;
}
処理を追加する。
// コンストラクタ
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;
}
プロジェクトをビルドしてエラーが出ないことを確認します。
Actorを配置する
UE4エディターに戻って「コンテンツブラウザ」から「MyActor」をビューポートにドラッグ&ドロップする。
「ワールドアウトライナー」に「MyActor1」が追加されアクターの詳細が設定できる様になります。
「MyActor1」の「詳細パネル」の「コンポーネントを追加」から適当な図形を選択します。ここでは球(Sphere)を選択。
これでビューポートにアクターが表示されました。
実行すると上下にSin移動します。