The local space is the coordinate system that uses the point of the object as the origin of the coordinate system;
The space of the parent node is the coordinate system where the parent node is located;
The World Space is the coordinate system with (0, 0, 0) as the coordinate origin.
By default, scene nodes change the space to the parent node space (ts_parent). Therefore, when using the parent node space transformation, no additional settings are required:
Mscenenode-> translate (100.0, 10.0, 0.0 ); |
However, if you need to perform node transformation in the world space, call the following method:
Mscenenode-> translate (100.0, 10.0, 0.0, ts_world ); |
The same is true for Ontology space transformation. The following indicates moving a node "Forward" 100 units along its orientation:
Mscenenode-> translate (0.0, 0.0, 100.0, ts_local ); |
The default space for rotating scene nodes is local space (ts_local). If you need different rotating spaces, you must explicitly inform ogre:
// The object rotates a radian around its Y axis, with an angle of about 57. Mscenenode-> yaw (Ogre: radian (1.0 )); // Rotate the Radian of an object around the X axis of the parent node, which is about 57 degrees. Mscenenode-> pitch (Ogre: radian (1.0), ts_parent ); // Rotate a radian In the Z axis of the object around the world, with an angle of about 57 Mscenenode-> Roll (Ogre: radian (1.0), ts_world ); |
No relational space is required for scaling. It is executed on the node itself and affects all subnodes of the node.
// Zoom twice on the X axis, but not on other Axes Mscenenode-> Scale (2.0, 1.0, 1.0 ); |
Tip: If you find that the entity model suddenly changes when you scale the scene node. This may be because the normal is scaled together, because the light calculation will reference the data of the standard normal, and the scaled normal will have a corresponding impact on the calculation. The solution is to call the setnormalisenormals () method after scaling, but this also consumes some execution efficiency. |