view Paper/appendix.tex @ 0:163b2493fb51

first commit
author e165727 <e165727@ie.u-ryukyu.ac.jp>
date Thu, 16 Jan 2020 23:52:18 +0900
parents
children
line wrap: on
line source

\appendix

\chapter{BP簡易解説}

\section{各ワイヤについて}
\subsection{イベント}
白色の矢印アイコンから始まる白いワイヤ(図\ref{01})を辿っていくことで、BP上のイベントの流れを確認することができる。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/01.png}
	\end{center}
	\caption{イベントワイヤ}
\label{01}
\end{figure}
\subsection{値}
以下の丸型アイコンから始まる各色のワイヤは値の流れを示す(図\ref{02})。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/02.png}
	\end{center}
	\caption{値ワイヤ}
\label{02}
\end{figure}

\subsection{配列}
以下のアイコンから始まる各色のワイヤは色に対応した値を要素とする配列の流れを示す(図\ref{03})。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/03.png}
	\end{center}
	\caption{配列ワイヤ}
\label{03}
\end{figure}

\subsection{ワイヤの指向性}
ワイヤに値を流す時には、任意のノード右側の接続点からワイヤを引く。
ワイヤから値を受け取る際には、ノード左側の接続点にワイヤを接続する。

ノード右側の接続点からノードが値を受け取ったり、ノード左側からワイヤに値を渡すことはない。

以上により、BPのイベントの流れは一般に「左から右へ」進んでいく(図\ref{04})。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=6cm]{fig/04.png}
	\end{center}
	\caption{簡易なBPの例}
\label{04}
\end{figure}

\section{ワイヤの色について}
\subsection{白}
白色のワイヤはイベントの流れを表す。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/05.png}
	\end{center}
	\caption{イベントワイヤ}
\label{01}
\end{figure}
\subsection{深青}
深青色のワイヤはUE4で定義され、またはプログラマが定義した構造体のデータの流れを表す。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/06.png}
	\end{center}
	\caption{Structワイヤ}
\label{01}
\end{figure}
\subsection{赤}
赤色のワイヤはTRUEまたはFALSEの2値のうちどちらかを表すBoolean型のデータの流れを表す。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/07.png}
	\end{center}
	\caption{Booleanワイヤ}
\label{01}
\end{figure}
\subsection{シアン}
シアンのワイヤは整数型のデータの流れを表す。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/08.png}
	\end{center}
	\caption{Integerワイヤ}
\label{01}
\end{figure}
\subsection{緑}
緑色のワイヤは浮動小数点数、Float型のデータの流れを表す。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/09.png}
	\end{center}
	\caption{Floatワイヤ}
\label{01}
\end{figure}
\subsection{金}
金色のワイヤはVector型、3個の浮動小数点数からなるベクトル様データの流れを示す。これはオブジェクトの座標位置を表すだけでなく、オブジェクトの拡大縮小率、RGB情報などを格納することもできる。
\begin{figure}[H]
	\begin{center}
		\includegraphics[width=12cm]{fig/10.png}
	\end{center}
	\caption{Vectorワイヤ}
\label{01}
\end{figure}
\subsection{紫}
紫色のワイヤはRotator型、3D空間の回転を定義するデータの流れを表す。
\begin{figure}[H]
	\begin{center}
		\includegraphics[width=12cm]{fig/11.png}
	\end{center}
	\caption{Rotatorワイヤ}
\label{01}
\end{figure}
\subsection{オレンジ}
オレンジ色のワイヤはTransform型のデータの流れを示す。この型は3D空間の位置を定義するVector型の値、3D空間の回転を定義するRotator型、3D空間の拡大縮小率を定義するVector型によって構成される、9値のfloat型により構成された構造体である。
\begin{figure}[H]
	\begin{center}
		\includegraphics[width=15cm]{fig/12.png}
	\end{center}
	\caption{Transformワイヤ}
\label{01}
\end{figure}
\subsection{青}
青色のワイヤはObject型のデータの流れを示す。ゲーム内オブジェクトを検索、取得すれば青色ワイヤによって他のノードにオブジェクトの情報を渡すことができる。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/13.png}
	\end{center}
	\caption{Objectワイヤ}
\label{01}
\end{figure}

\section{異なる色の接続点間の接続}
\subsection{型変換が行われる場合}
型変換が自動で行われる色同士の場合(シアン-緑等)は、接続点同士を繋げた瞬間に型変換ノードが挿入される。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=5cm]{fig/14.png}
	\end{center}
	\caption{型変換ノード}
\label{01}
\end{figure}
\subsection{型変換が行われない場合}
型変換が行われない色同士の場合(シアン-青、金-白等)は、接続点同士を繋げようとした時に警告文が表示され、接続がキャンセルされる。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=5cm]{fig/15.png}
	\end{center}
	\caption{互換性のない型とエラーメッセージ}
\label{01}
\end{figure}

\section{基本的な変数ノード}
\subsection{四則演算}
四則演算ノードは、例として$A-B$を行う場合には引き算ノードの上に$A$、下に$B$を接続する。異なる型同士でも四則演算が可能である。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=5cm]{fig/16.png}
	\end{center}
	\caption{四則演算の例}
\label{01}
\end{figure}
\subsection{GET}
GETは最も簡単なノードで、変数の値を参照し、他のノードに接続して使用する。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/17.png}
	\end{center}
	\caption{GETノード}
\label{01}
\end{figure}
\subsection{GetActorLocation}
GetActorLocationは、Objectを引数としてその3D座標を返すノードである。引数が指定されない場合、GetActorLocationを実行するActor(キャラクターやオブジェクト等のこと)自身の座標を返す。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/18.png}
	\end{center}
	\caption{GetActorLocation}
\label{01}
\end{figure}
\subsection{GetActorRotation}
GetActorRotationはObjectを引数としてその回転を返すノードである。引数を指定しない場合、自身の回転を返す。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/19.png}
	\end{center}
	\caption{GetActorRotation}
\label{01}
\end{figure}
\subsection{GetActorTransform}
GetActorTransformはObjectを引数としてその位置、回転、拡大率を返すノードである。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/20.png}
	\end{center}
	\caption{GetActorTransform}
\label{01}
\end{figure}

\section{基本的なイベントノード}
\subsection{Event Tick}
Tickは1フレーム毎に実行されるイベントである。返り値のDeltaSecondsとは、そのTickの秒数である。UE4は可変フレームレートであり、フレームレートに依存しないゲームプレイを実現するため、DeltaSecondsを有効に使用する必要がある。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/21.png}
	\end{center}
	\caption{イベントTick}
\label{01}
\end{figure}
\subsection{Event Begin Play}
BeginPlayはActorが生成された時に実行されるイベントである。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/22.png}
	\end{center}
	\caption{イベントBeginPlay}
\label{01}
\end{figure}
\subsection{Apply Damage}
ApplyDamageはActorにダメージを与える際に使用する特別なノードである。ダメージを与えられるActorとダメージ量を引数に指定する。ActorはApplyDamageでダメージを与えられると、イベントAnyDamageを実行する。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=6cm]{fig/23.png}
	\end{center}
	\caption{ApplyDamage}
\label{01}
\end{figure}
\subsection{Event Any Damage}
AnyDamageはActorがApplyDamageによってダメージを与えられた時に実行するイベントである。ダメージの大きさ、ダメージを与えたActorを参照することができる。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=5cm]{fig/24.png}
	\end{center}
	\caption{イベントAnyDamage}
\label{01}
\end{figure}
\subsection{カスタムイベント}
カスタムイベントは開発者が自由に名前を決めることができるイベントである。カスタムイベントを作成すると、任意のタイミングをBPで指定し、実行することができる。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/25.png}
	\end{center}
	\caption{カスタムイベント}
\label{01}
\end{figure}
\subsection{Sequence}
Sequenceはイベントノードを分岐させ、全ての分岐を擬似的に並列に実行していくノードである。実際には実行順序にごくわずかな時間差があり、割り振られた数字の小さい方から実行されていくが、通常の記述において実行順を気にする必要はほとんどない。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=5cm]{fig/26.png}
	\end{center}
	\caption{Sequence}
\label{01}
\end{figure}
\subsection{SET}
SETは変数に値を代入するノードである。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=3cm]{fig/27.png}
	\end{center}
	\caption{SET}
\label{01}
\end{figure}
\subsection{Branch}
BranchはBoolean型変数を引数とし、その値によってイベントを分岐させる、If文と同じ用途のノードである。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=4cm]{fig/28.png}
	\end{center}
	\caption{Branch}
\label{01}
\end{figure}
\subsection{ForEachLoop}
ForEachLoopは配列を引数とするループ文である。LoopBodyは配列の要素数だけ実行され、その返り値は配列の内容および配列の添字である。BodyLoopの実行が全て終了するとCompletedに移行する。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=4cm]{fig/29.png}
	\end{center}
	\caption{ForEachLoop}
\label{01}
\end{figure}
\subsection{MultiLineTraceForObjects}
MultiLineTraceForObjectsは、任意の線分上に存在するObjectの配列を作成するノードである。線分の始点および終点、配列作成の対象とするCollisionの種類、配列作成から除外するActor、自己を検出対象とするかどうかを引数とする。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=8cm]{fig/30.png}
	\end{center}
	\caption{MultiLineTraceForObjects}
\label{01}
\end{figure}
\subsection{SetActorTransform}
SetActorTransformはActorの位置、回転、拡大率を変更するノードである。変更するActorと変更するTransform型の値を引数とする。SetActorTransformの他に、SetActorLocationやSetActorRotationなども存在する。
\begin{figure}[H]
	\begin{center}
		\includegraphics[height=5cm]{fig/31.png}
	\end{center}
	\caption{SetActorTransform}
\label{01}
\end{figure}
\subsection{Cast to xxx}
Cast to xxxノードは引数に与えたObjectがxxxであるかどうかを判定するノードである。xxxである場合にはその内部にアクセスできるようになる。たとえば、Castした先のObjectが持っている変数を書き換える場合や、Cast先のイベントを実行する場合などに用いられる。

\begin{figure}[H]
	\begin{center}
		\includegraphics[height=10cm]{fig/castto.png}
	\end{center}
	\caption{SetActorTransform}
\label{01}
\end{figure}