LoginSignup
4
4

More than 3 years have passed since last update.

[UE4] ViewCameraを移動するコマンド

Last updated at Posted at 2019-12-13

1. 概要

Viewport Cameraの位置を指定の座標に移動するコンソールコマンドを紹介します。
使い方はコマンドの入力バー(コンソール)を出して"JumpTo x,y,z"のフォーマットで入力するだけです。

2. コマンド

JumpTo
・"JumpTo x,y,z"(例:JumpTo 100,100,100)のように移動先の座標を後ろに入力します
・PIEの場合のみ有効、F8でEjectした状態からこのコマンドを入力すると移動できます
・Viewport上(ViewportCamera)の座標を移動するため、特定のものを捜索する場合に便利です
 例:Collision Analyzerからコリジョンイベントの発生源を確認する
 例:BugItコマンドからバグの発生した場所を確認する

2019-11-14_12h56_42.gif

以下のようにCallInEditorのイベントを利用することで、ボタン1つで特定の座標に移動できるActorを作成することも可能です。

2019-11-14_12h51_42.png
2019-11-14_12h51_53.png

3. 実装

実装はEditorServer.cppの以下の箇所で定義されています。

EditorServer.cpp

bool UEditorEngine::Exec( UWorld* InWorld, const TCHAR* Stream, FOutputDevice& Ar )
{
    // ...
    else if( FParse::Command(&Str,TEXT("JUMPTO")) )
    {
        return HandleJumpToCommand( Str, Ar );
    }
    // ...

}

bool UEditorEngine::HandleJumpToCommand( const TCHAR* Str, FOutputDevice& Ar )
{
    FVector Loc;
    if( GetFVECTOR( Str, Loc ) )
    {
        for(FLevelEditorViewportClient* ViewportClient : GetLevelViewportClients())
        {
            ViewportClient->SetViewLocation( Loc );
        }
    }
    return true;
}

4. まとめ

このコンソールコマンドを利用すると問題箇所の特定や調査をするのに役立ちます。
これらをうまく活用してデバッグを効率的に行いましょう。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4