A slew of commands within Vizard's node3d library allow you to change the position, rotation, color, visibility, and scale of the 3D models you've created or imported. Note: if you want to render these transformations as a process instead of an instantaneous change (if you want to show an object moving as opposed to simply popping up elsewhere), go to the section on actions and animation paths. To work directly with the matrix transformations that underlay the position and orientation of an object, check out the section on matrix transforms. To make your objects behave more like they would in the physical world (with collision, friction, etc.), check out the section on Physics.
Once you've added a 3d object to your world, you'll want to place it in the appropriate position using x, y, and z coordinates. Anytime you set the position of an object, you do so with reference to a coordinate system. Also, the values you provide can either be "absolute" or "relative to the object's current position." Together these parameters make up the transformation mode (see section below).
3D objects rotate around the x, y, and z axes. Rotations around the x axis are changes in pitch, rotations around the y axis are changes in yaw, and rotations around the z axis are changes in roll. For more about these terms, check out the section on Understanding Coordinate Systems.
When you're rotating an object in Vizard, you can do so by providing axis angles, eulers, or quaternions. When you use axis angles to specify a rotation, you provide the axis of rotation and the number of degrees which you want to rotate about that axis. When you use eulers, you provide yaw, pitch and roll rotations for the object in degrees and the rotations are applied in that order (first yaw, then pitch, then roll). You can also specify rotations using quaternions, which define a rotation using a vector and a value for rotation about that vector.
Anytime you set the orientation of an object, you do so with reference to a coordinate system. The rotation can either be absolute or relative to the object's current orientation. Together these parameters make up the transformation mode (see section below).
Objects can be scaled in all three dimensions, so when you scale an object you must specify which dimensions you want to scale it in. So, to change the size uniformly, you would apply the same sized scale to each dimension. To stretch the object in one direction or the other, you would apply scaling differently to the x, y, or z dimension. A scale value of 1 will scale the object to its original size. Numbers between 0 and 1 will shrink the object, while numbers larger the one will make increase its size.
Note: Non-uniform scaling can result in strange rotations. Avoid performing non-uniform scale operations if you will also be performing complex rotations. You are better off modifying the object in a professional 3D modeling package.
When you're specifying the position or orientation of an object, those transformations are relative to either the global coordinate system, the object's own local coordinate system, or the object's parent's coordinate system. Within one of those coordinate systems, you can either change relative to the object's current position and orientation or in absolute terms. Together these options comprise five transformation modes: relative change within the local coordinate system (viz.REL_LOCAL), relative change within the parent coordinate system (viz.REL_PARENT), absolute change within the parent coordinate system (viz.ABS_PARENT), relative change within the global coordinate system (viz.REL_GLOBAL), and absolute change within the global coordinate system (viz.ABS_GLOBAL).
Transformation mode |
Flag |
relative change in the local coordinate system |
viz.REL_LOCAL |
relative change in the parent's coordinate system |
viz.REL_PARENT |
relative change in the global coordinate system |
viz.REL_GLOBAL |
absolute change in the parent's coordinate system |
viz.ABS_PARENT |
absolute change in the global coordinate system |
viz.ABS_GLOBAL |
When you rotate or scale an object, the transformation will occur about its local origin (i.e. [0,0,0]). You can, however, change the center anywhere within the object, or even outside of the object. So, if you wanted to rotate a ball around its side instead of its middle, you could place the center on the outer edge of the ball using the <node3d>.setCenter command.
3D model transforms command table
Appearance and texturing basics
Creating 3D models on-the-fly-- the basics