Mesh
- Last UpdatedOct 22, 2025
- 9 minute read
The Mesh node links a mesh object inside the scene to a logic object.
-
Use this node to access the mesh to move it or to read and write its parameters.
-
The Mesh node has many parameters and there are many different way to use it.
Platform support
This node is fully supported on XR-Windows platform.
It is partially supported on XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM platforms.
Collision is not supported on the portable platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Partial support |
Partial support |
Partial support |
Partial support |
|
|
|
|
|
|
Create a mesh node
This is the suggested method to create a Mesh node linked to a mesh inside an MWX.
-
Use the Graphic Context Editor Add item from template functionality.
-
Configure the Mesh using the Node property editor or edit it from the Graphic Context Editor 3D View Panel..
LOD behavior
Mesh LOD behavior is defined inside the MWX file. Mesh node LOD values are read from MWX, but can be overridden if needed.
You can use LODManualShow for debugging purposes to force a particular LOD level visualization.
Position
The Mesh node must be inside a context node, such as Context or Global.
Code example
This is a code example for the Mesh node.
<Mesh name="omino" mesh="Omarino3D"/>
Managing mesh space transformations
Many parameters can help compose the final position, rotation, scale of a mesh, which allows a lot of flexibility in the configuration.
Rotation matrix
The rotation matrix set in the Mesh field rotationMatrix defines how to apply transformations to the Mesh geometry and which are the fields that contribute to those transformations.
|
Attribute |
Description |
|---|---|
|
old |
Transformations are not to be explicitly set. Used for retro-compatibility. Not supported on XR-Portable. |
|
start |
Transformations from position, orientation, scale, position_offset, orientation_offset, yaw, pitch, matrix and matrix_offset fields are applied with reference to initial mesh transformation. |
|
local |
Transformations from position, orientation, scale, position_offset, orientation_offset, yaw, pitch, matrix and matrix_offset fields are applied in the Mesh local space. The transformations are applied following the order described below. |
|
transform |
In transform mode, the initial transformations read from the MWX file are directly reflected into the position, rotation, and scale fields of the Mesh node, so that all the transformations are always explicitly represented by the node fields. This uses the following fields: position, rotation, scale, positionOffset, rotationOffset, scaleOffset, matrix. Transform mode is the recommended mode to use because it is geometrically consistent in any possible case. It uses Quaternions for rotations and allows the creation of complex animations without the need to use parenting or other workarounds. Note that to use transform mode, the Mesh geometry must be exported in ObjectSpace. For more information on the order of application of the transformations, see the Transform Sequence section on this page. |
Matrix operation sequence
The matrix operation sequence is the sequence of transformation operations done by the engine to transform the mesh.
-
The starting point depends on the rotationMatrix value.
-
The legacy sequence is used by the start and local options of rotationMatrix.
-
The transform sequence is used by the transform option of rotationMatrix.
-
The old option uses a different and discontinued approach.
-
All operations are composed according to their order.
-
Not all of these fields require values. Sometimes, values for position and rotation are enough. Default values usually represent an Identity transformation Matrix, meaning that it will not change the overall transformation once applied.
Legacy sequence
-
scale
-
-center
-
yaw (0,1,0)
-
pitch (1,0,0)
-
orientation
-
orientation_offset
-
(if useCameraYaw) set yaw to align to camera-mesh vector.
-
+center
-
position
-
position_offset
-
matrix
-
matrix_offset
Transform sequence
-
scaleOffset
-
rotationOffset
-
positionOffset
-
scale
-
rotation
-
position
-
matrix
Looking closely at the order, we can say that there are three major transformations that can be represented by a transformation Matrix:
-
TransformOffset, which consists in scaleOffset * rotationOffset * positionOffset.
-
Transform, which consists in scale * rotation * position.
-
Matrix, which consists in the matrix field.
With this in mind, we can say that the final transformation of the Mesh is:
TransformOffset * Transform * matrix * Parent
Where Parent is the transformation of the parent mesh or Identity matrix in case of no mesh parenting.
Chain of matrices
The chain of matrices is similar in behavior to parented Objects. However, in this case, the TransformOffset is the child of Transform, which is the child of matrix which is, lastly, the child of Parent.
Animations that might require using the other rotationMatrix modes to achieve parenting, can instead use this relationship between the transformations within a single Mesh node.
Mesh fields
These are the fields for Mesh node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase à Mesh
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
center |
svec3 |
Read only |
0 0 0 |
Positions the center of the mesh object for rotations. |
|
collisionWithCMesh |
sbool |
Read only |
Internally calculated |
Set to True, in case of collision. Evaluated only if enableCollissionWithCMesh is set to True. |
|
castShadows |
senum |
Optional |
default |
Set to default keeps setting defined in MWX or by config.xml. Set to True or False overrides it. |
|
clone |
sstring |
Optional |
Not set |
Use this parameter only when required to create a cloned mesh. This parameter must be set to the name of the scene mesh object to clone. |
|
displayOverPostEffects |
sbool |
Optional |
false |
If set to true the mesh gets visualized over any Filler and Silhouette. |
|
enableCollisionWithCMesh |
sbool |
Optional |
false |
If set to True, checks for collisions. |
|
faceCamera |
sbool |
Optional |
false |
Used only in old rotationMatrix mode. It offers similar functionalities to useCameraYaw. |
|
fade |
svec3 |
Optional |
Not set |
Trigger a fade animation. The parameters are:
|
|
fadeIn |
sfloat |
Optional |
Not set |
Triggers fadeIn with given time interval, in seconds. The fade always start from an opacity of 0 and ends with an opacity of 1. It automatically sets visible to true at the start of the fade. |
|
fadeOut |
sfloat |
Optional |
Not set |
Triggers fadeOut with given time interval, in seconds. The fade always start from current opacity and ends with an opacity of 0. It automatically sets visible to false at the end of the fade. |
|
get_position |
svec3 |
Read only |
Not set |
Returns the World position coordinates of the mesh. |
|
getLocalMatrix |
sfunction |
Read only |
Not set |
Returns the Mesh Local Matrix. In cases where the Mesh parent is the scene root (no parent) or its parent transformation is an Identity Matrix this is equal to getWorldMatrix field. |
|
getWorldMatrix |
sfunction |
Read only |
Not set |
Returns the Mesh World Matrix. |
|
hide |
sevent |
Optional |
Not set |
Sets mesh to not visible. |
|
LODMNum |
sint |
Optional |
0 |
Currently visualized LOD level |
|
LODUseScreenSpaceValues |
senum |
Optional |
Default |
Default keeps default mode selected. True ranges are expressed in screen space percentage, False ranges are in meters. |
|
LODranges |
mfloat |
Optional |
Not set |
LOD ranges in meters or % of screen occupation according to LODUseScreenSpaceValues value. |
|
LODManualShow |
sint |
Optional |
-1 |
Can be used to override range-based LOD selection. Resetting to -1 returns to its value. |
|
materialTexture |
sstring |
Optional |
Not set |
Changes the material texture for the mesh. |
|
matrix |
smatrix |
Optional |
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 |
This Matrix represent a space transformation that concurs to the final transformation of the node. It contributes to the node transformation depending on the selected rotationMatrix (Start, Local or Transform). |
|
matrix_offset |
smatrix |
Optional |
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 |
This Matrix represent a space transformation that concurs to the final transformation of the node. It contributes to the node transformation depending on the selected rotationMatrix (Start or Local). |
|
mesh |
sstring |
Mandatory |
Not set |
If the mesh is not a clone, this field must contain the name of the mesh object in the scene. Otherwise, if you are creating a cloned mesh, this field must contain a new unique name for this mesh object in the scene. |
|
opacity |
sfloat |
Optional |
Current Mesh Opacity |
This field reflects the actual current opacity of the mesh and can be used to both read and write it. Any changes by fade, fadeIn, fadeOut and set_fade to current opacity update this field value at runtime. Changes to the mesh opacity from a different node (such as Scenegraph) will not automatically update this value. |
|
orientation |
svec3 |
Optional |
Not set |
Rotates the mesh. The three elements of the vector are yaw, pitch, and roll. The values are in radiants. It contributes to the node transformation depending on the selected rotationMatrix (Start or Local). |
|
orientation_offset |
svec3 |
Optional |
Not set |
Adds more rotation to the mesh. The three elements of the vector are yaw, pitch, and roll. The values are in radiants. Rotates the mesh. The three elements of the vector are yaw, pitch, and roll. The values are in radiants. It contributes to the node transformation depending on the selected rotationMatrix (Start or Local). |
|
pitch |
sfloat |
Optional |
Not set |
Pitch can be used to rotate the mesh against the x axis. Accepts radiants values. It contributes to the node transformation depending on the selected rotationMatrix (Start or Local). |
|
position |
svec3 |
Optional |
Not set |
Sets the position of the mesh. The field used to retrieve current position of the mesh is get_position. It contributes to the node transformation depending on the selected rotationMatrix (Start or Local). |
|
position_offset |
svec3 |
Optional |
Not set |
Offsets the mesh position without losing the position. For example, moving it up and down with a sin. It contributes to the node transformation depending on the selected rotationMatrix (Start or Local). |
|
positionOffset |
svec3 |
Optional |
0 0 0 |
This parameter sets the positionOffset transformation of the Mesh. It contributes to the node transformation only if rotationMatrix is Transform. |
|
receiveShadows |
senum |
Optional |
default |
Set to default keeps setting defined in MWX or by config.xml. Set to True or False overrides it. |
|
refreshOpacity |
sfunction |
Read only |
Not set |
Since changes to the mesh opacity from a different node (such as Scenegraph) will not automatically update opacity field value, this SFUNCTION can be called on-demand to make sure that opacity field is updated with the actual current opacity of the mesh. To avoid performance issues, it is strongly advised to avoid using this field every frame and/or from a very large amount of nodes concurrently. |
|
rotation |
squat |
Optional |
0 0 0 1 |
Sets the rotation transformation of the Mesh. It contributes to the node transformation only if rotationMatrix is Transform. |
|
rotationMatrix |
senum |
Optional |
local |
Defines whether the mesh rotation must be handled referring to mesh or scene coordinates. start, local and old are the accepted values. |
|
rotationOffset |
squat |
Optional |
0 0 0 1 |
Sets the rotationOffset transformation of the Mesh. It contributes to the node transformation only if rotationMatrix is Transform. |
|
scale |
svec3 |
Optional |
1 1 1 |
Sets the scale transformation of the Mesh. It contributes to the node transformation depending on the selected rotationMatrix (Start, Local or Transform). |
|
scaleOffset |
svec3 |
Optional |
1 1 1 |
Sets the scaleOffset transformation of the Mesh. It contributes to the node transformation only if rotationMatrix is Transform. |
|
set_fade |
sfloat |
Optional |
Not set |
Sets the mesh fade level (0 to 1). The same can be achieved by using opacity field. The set_fade field is a legacy, kept only for backward-compatibility. In cases where both opacity and set_fade are modified, opacity value is the one being used. |
|
show |
sevent |
Optional |
Not set |
Sets mesh to visible. |
|
skipScreenSpaceCulling |
sbool |
Optional |
false |
If set to True, then the mesh is never culled. |
|
useCameraYaw |
sbool |
Optional |
false |
If set to True, the mesh yaw is modified according to the camera to mesh vector in a way to always show the same side. |
|
visible |
sbool |
Optional |
Mesh visibility start value |
Reads or writes display state of the mesh. |
|
yaw |
sfloat |
Optional |
Not set |
Yaw can be used to rotate the mesh against the y axis. Accepts radiants values. |