3D Space Transformations
There are three ways to transform a component:
- Rotate - Spins a component around the x, y and/or z axes of the parent component.
- Scale - Expands or contracts a component relative to the x, y and z axes of the parent component.
- Translate - Moves a component relative to the x, y or z axis of the parent component.
All children inherit the transformations of the parent component. All transformations occur in the order in which they appear within a component.
Rotate
Use
Rotate
to turn the component about the x, y or z axis. For instance,
Rotate
can be used to simulate the lowering of the space shuttles landing gear or opening of the space shuttles doors. The command is formatted as:
Rotate <rx> <ry> <rz>
Rotations are applied in consecutive order, beginning with the X axis (i.e., X, and then Y, and then Z). This example first rotates the ChildComponent 20 degrees around the x axis, and then 10 degrees around the y axis of the ParentComponent:
Component ParentComponent
Rotate 20.0 10.0 0.0
ReferComponent ChildComponentEndRefer
EndComponent
Two or more
Rotate
commands can be used to rotate a component out of the <rx>
, <ry>
, <rz>
sequence. This example first rotates the
ChildComponent
10° around the y axis of the
ParentComponent
, and then 20° around the x axis
Component ParentComponent
Rotate 0.0 10.0 0.0
Rotate 20.0 0.0 0.0
ReferComponent ChildComponentEndRefer
EndComponent
Scale
Use the Scale transformation to change the size of a specified component. There are two primary
Scale
commands:
Scale
and
UniformScale
. The commands are formatted as:
Scale <sx> <sy> <sz>
or
UniformScale <xyz>
The
Scale
command specifies individual multipliers for each axis; the
UniformScale
command specifies one multiplier for all axes. In this example, the
ChildComponent
is stretched 2.0 times along the x axis, 1.0 times along the y axis and 0.4 times along the z axis of the
ParentComponent
:
Component ParentComponent
Scale 2.0 1.0 0.4
ReferComponent ChildComponentEndRefer
EndComponent
In this example, the
ChildComponent
is stretched 7.2 times along the x, y and z axes of the
ParentComponent
:
Component ParentComponent
UniformScale 7.2
ReferComponent ChildComponentEndRefer
EndComponent
Translate
Use the
Translate
transformation to move an object along the x, y or z axis. For instance,
Translate
can be used to illustrate the staging of a missile. The command is formatted as:
Translate <tx> <ty> <tz>
Example of the translate transformation:
Component ParentComponent
Translate 0.5 -10.7 35.0
ReferComponent ChildComponentEndRefer
EndComponent