$this.world = (parent.world \cdot this.local)$ 임을 이용해, 자신의 world transform 을 계산합니다. 부모가 없다면 local transform 은 world transform 과 같습니다. world transform 이 수정되었으므로 자신의 자식들의 world transform 또한 수정되야 합니다.

계산을 단순화시키기 위해서, 리프 트랜스폼이 아니라면(Non-leaf transform), 비균등한 스케일링(Non-uniformed scaling)을 지원하지 않음에 주목하시길 바랍니다.

Syntax

transform.#calculateWorld();

Parameters

(none)

Return value

(none)

Description

로컬 트랜스폼(local transform)은 자신의 캐릭터가 원점(Origin)에 놓여져 있다고 생각하고 수행하는 변환(Transformation)을 의미합니다. 그리고 월드 트랜스폼(world transform)은 로컬 공간에서 변환이 끝나고, 실제로 캐릭터가 있을 위치까지 옮겨주는 변환(Transformation)을 의미하죠.

$$

TRS = (T\cdot R\cdot S) = \begin{bmatrix} 1 & 0 & 0 & t_x\\ 0 & 1 & 0 & t_y\\ 0 & 0 & 1 & t_z\\ 0 & 0 & 0 & 1 \end{bmatrix}\cdot \begin{bmatrix} a & b & c & 0\\ d & e & f & 0\\ g & h & i & 0\\ 0 & 0 & 0 & 1 \end{bmatrix}\cdot \begin{bmatrix} s_x & 0 & 0 & 0\\ 0 & s_y & 0 & 0\\ 0 & 0 & s_z & 0\\ 0 & 0 & 0 & 1 \end{bmatrix}\\

= \begin{bmatrix} a\cdot s_x & b\cdot s_y & c\cdot s_z & t_x\\ d\cdot s_x & e\cdot s_y & f\cdot s_z & t_y\\ g\cdot s_x & h\cdot s_y & i\cdot s_z & t_z\\ 0 & 0 & 0 & 1 \end{bmatrix}

$$

$$ \acute{T}\acute{R}\acute{S}=

(\acute{T}\cdot\acute{R}\cdot\acute{S})=

\begin{bmatrix}1 & 0 & 0 & \acute{t}_x\\ 0 & 1 & 0 & \acute{t}_y\\ 0 & 0 & 1 & \acute{t}_z\\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot

\begin{bmatrix} \acute{a} & \acute{b} & \acute{c} & 0\\ \acute{d} & \acute{e} & \acute{f} & 0\\ \acute{g} & \acute{h} & \acute{i} & 0\\ 0 & 0 & 0 & 1 \end{bmatrix}

\cdot

\begin{bmatrix} \acute{s}_x & 0 & 0 & 0\\ 0 & \acute{s}_y & 0 & 0 \\0 & 0 & \acute{s}_z & 0 \\0 & 0 & 0 & 1 \end{bmatrix} \\ =\begin{bmatrix}\acute{a} \cdot \acute{s}_x & \acute{b} \cdot \acute{s}_y & \acute{c} \cdot \acute{s}_z & \acute{t}_x\\\acute{d} \cdot \acute{s}_x & \acute{e} \cdot \acute{s}_y & \acute{f} \cdot \acute{s}_z & \acute{t}_y\\\acute{g} \cdot \acute{s}_x & \acute{h} \cdot \acute{s}_y & \acute{i} \cdot \acute{s}_z & \acute{t}_z\\0 & 0 & 0 & 1\end{bmatrix} $$