Jump to content

XML:OBAN: Difference between revisions

3,760 bytes added ,  31 October 2013
no edit summary
m (-create:oban (cam roots not supported))
No edit summary
Line 161: Line 161:
** this would be very useful for editing/creating single OBAN files if the rest of the level don't need changes
** this would be very useful for editing/creating single OBAN files if the rest of the level don't need changes


===calculating a transform matrix step by step===
In some scenarios we need to build a new transform matrix, e.g. when making a new weapon particle emitter.
Those commands can be used to examine OniSplit's matrix calculation.
onisplit -create:oban OBAN OBAN/file.dae
onisplit -extract:xml OBAN OBAN/OBANfile.oni
Let's test some values.
xyz = 0
<InitialTransform>1 0 0 0 1 0 0 0 1 0 0 0</InitialTransform>
This doesn't tell us very much, at least we know that the last 3 value are positions.
{| class="wikitable" style="float:right; text-align:right"
| This formula is involved in building such matrix.
https://dl.dropboxusercontent.com/u/139715/OniGalore/rotation_of_transform_matrix.png
|}
So the first 9 values have to contain the rotation.
x = 60
<InitialTransform><span style="background-color:#F77">1 0 0</span> <span style="background-color:#7F7">0 0.5    0.8660254</span> <span style="background-color:#77F">0 -0.8660254 0.5</span>    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
                  <span style="background-color:#F77">1 0 0</span> <span style="background-color:#7F7">0 cos(x) sin(x)</span>    <span style="background-color:#77F">0 -sin(x)    cos(x)<span>
y = 60
<InitialTransform><span style="background-color:#FF7">0.5    0 -0.8660254</span> <span style="background-color:#F7F">0 1 0</span> <span style="background-color:#7FF">0.8660254 0 0.5</span>    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
                  <span style="background-color:#FF7">cos(y) 0 -sin(y)</span>    <span style="background-color:#F7F">0 1 0</span> <span style="background-color:#7FF">sin(y)    0 cos(y)</span>
z = 60
<InitialTransform><span style="background-color:#777">0.5    0.8660254 0</span> <span style="background-color:#AAA">-0.8660254 0.5    0</span> <span style="background-color:#DDD">0 0 1</span> <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
                  <span style="background-color:#777">cos(z) sin(z)    0</span> <span style="background-color:#AAA">-sin(z)    cos(z) 0</span> <span style="background-color:#DDD">0 0 1</span>
x = 60; y = 40
<InitialTransform>0.7660444 0.5566704      -0.321393818  0 0.5    0.8660254 0.6427877 -0.663413942  0.3830222    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
                  cos(y)    sin(x)*sin(y)  -cos(x)*sin(y) 0 cos(x)  sin(x)    sin(y)    -sin(x)*cos(y) cos(x)*cos(y)
                  cos(y)    -sin(x)*-sin(y) -cos(x)*sin(y) 0 cos(x)  sin(x)    sin(y)    -sin(x)*cos(y) cos(x)*cos(y)
x = 60; z = 40
<InitialTransform>0.7660444 0.321393818  0.5566704      -0.6427877 0.3830222        0.663413942  0 -0.8660254  0.5    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
                  cos(z)    cos(x)*sin(z) sin(x)*sin(z)  -sin(z)    cos(x)*cos(z)    sin(x)*cos(z) 0 -sin(x)    cos(x)
                  cos(z)    cos(x)*sin(z) -sin(x)*-sin(z) -sin(z)    cos(x)*cos(z)    sin(x)*cos(z) 0 -sin(x)    cos(x)
y = 60; z = 40
<InitialTransform>0.3830222    0.6427877 -0.663413942  -0.321393818  0.7660444 0.5566704      0.8660254 0 0.5    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
                  cos(y)*cos(z) sin(z)    -sin(y)*cos(z) cos(y)*-sin(z) cos(z)    sin(y)*sin(z)  sin(y)    0 cos(y)
                  cos(x)*cos(z) sin(z)    -sin(y)*cos(z) cos(y)*-sin(z) cos(z)    -sin(y)*-sin(z) sin(y)    0 cos(y)
x = 60; y = 40; z = 20
<InitialTransform>0.719846249  0.6941092 -0.005813241 -0.262002677 0.279453874 0.9237208 0.642787635 -0.6634138 0.3830223    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
                  cos(y)*cos(z)                                                                                  cos(x)*cos(y)


{{XML}}
{{XML}}
8,018

edits