<sidebar>API Contents</sidebar> Rotates the object around the Z axis
- The position or component to update
- The default value for this parameter is: this
- An optional position to treat as the origin to rotate around
- Number of degrees to rotate by
This call does not return a value
The rotation call allows an object to be rotated around any point in the target objects local Z axis. This has the effect of altering the roll of the object - in terms of an aeroplane this makes the plane spin around.
The handle must be a valid handle to a component or position, or a quoted (string) name of an object that can be selected on the panel.
The PivotHandle is an optional position to rotate around. The object will adjust its angle as though it is sliding around the edge of a circle, so at 180 degrees the object will appear 'upside-down' in the same way as a human walking around the globe from the north to south pole.
If the PivotHandle is zero the object rotates around its own center.
The image to the right shows a cube with it's axis positions identified.
Calling the simulation api Panel.Position.RotateZ(MyCube,MyCube,1) will rotate the object in one-degree steps along it's Z-axis as shown by the blue rotation arc. To rotate the cube in a counter direction simply specify a negative number for the degrees parameter.
The screenshot from Flowcode v6 below shows a cuboid with it's internal axis shown (blue is the Z-axis line), and also a circle that cuts right through the cuboid's Z-axis (see example section below for links to the file) When the program runs the cuboid rotates along it's Z axis.
Calling in a calculation
- Add to a calculation icon:
::Panel.Position.RotateZ(handle, pivothandle, degrees)
Flowcode example file
Download SIMAPI_Panel_Position_RotateZ_v1 and open it in Flowcode v6.
The sample file SIMAPI Panel Position RotateXYZ rotates a grouped object around its X, Y, and Z axis.