setmatrix
- Last UpdatedMay 02, 2023
- 3 minute read
The setmatrix statement enables you to perform operations on matrix fields or locals.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Matrix structure
Rototranslation and scale matrices are right-handed.
The content of the matrix.
/ Rx Ry Rz 0 \ ® Right Vector
| Ux Uy Uz 0 | ® Up Vector
| Ax Ay Az 0 | ® At Vector
\ Px Py Pz 1 / ® Position vector
Available operations
These are the operations performed by this command.
|
Operation |
Operators |
Type |
Description |
|---|---|---|---|
|
identity |
0 |
None |
Sets matrix to identity. |
|
rotationx |
1 |
SFLOAT |
Generates a rotation matrix around x axis. The three elements of the vector are yaw, pitch, and roll. The values are in radiants. |
|
rotationy |
1 |
SFLOAT |
Generates a rotation matrix around y axis. The three elements of the vector are yaw, pitch, and roll. The values are in radiants. |
|
rotationz |
1 |
SFLOAT |
Generates a rotation matrix around z axis. The three elements of the vector are yaw, pitch, and roll. The values are in radiants. |
|
yawpitchroll |
1 |
SVEC3 |
Generates a rotation matrix according to provided yaw, pitch, and roll. . |
|
scale |
1 |
SVEC3 |
Generates a scale matrix according to provided scale factors. |
|
translation |
1 |
SVEC3 |
Generates a translation matrix according to provided vector. |
|
rotation |
1 |
SQUAT |
Generates a rotation matrix according to provided quaternion. |
|
transform |
1 |
SVEC3, SQUAT, SVEC3 |
Generates a matrix applying provided translation (SVEC3), rotation (SQUAT), and scale (SVEC3). Example: (0 0 0,1 0 1 0,1 1 1). |
|
compose |
2 |
None |
Composes matrix1 with matrix2. |
Code example
This is a code example for the setmatrix statement.
<command name="showmenu">
<local name="m1" type="smatrix" />
<setmatrix name="%m1%" op="rotationx" value="#rad(@cameraPitch.value@)#" />
<!-- ... -->
</command>
Fields
These are the fields for setmatrix statement.
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
matrix1 |
sstring |
Optional |
No default value |
The first operator of the matrix operation. |
|
matrix2 |
sstring |
Optional |
No default value |
The second operator of the matrix operation. |
|
name |
sstring |
Mandatory |
No default value |
The name of the matrix field to which to copy the operation result. |
|
op |
sstring |
Mandatory |
No default value |
Matrix operation. Valid options are: Identity, Value, Rotationx, Rotationy, Rotationz, Yawpitchroll, Scale, Translation, Compose. |
|
value |
sstring |
Optional |
No default value |
The parameter for the matrix operation. |