Difference between revisions of "API Panel.Position.RotateZ"

From Flowcode Help
Jump to navigationJump to search
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<sidebar>API contents</sidebar>
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Rotates the object around the Z axis
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RotateZ'''
 +
|-
 +
| colspan="2" | Rotates the object around the Z axis&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE
 +
| width="90%" | Handle
 +
|-
 +
| colspan="2" | The position or component to update&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE
 +
| width="90%" | PivotHandle
 +
|-
 +
| colspan="2" | An optional position to treat as the origin to rotate around&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 +
| width="90%" | Degrees
 +
|-
 +
| colspan="2" | Number of degrees to rotate by&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - NONE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
<div style="width:25%; float:right" class="toc">
 
====Class hierarchy====
 
[[API Panel|Panel]]
 
:[[API Panel.Position|Position]]
 
::[[API Panel.Position|RotateZ]]
 
</div>
 
__TOC__
 
  
==Parameters==
+
==Detailed description==
[[Variable types|HANDLE]] ''Handle''
+
[[file:SIMAPI_Panel_Position_RotateZ_Pic1.png|375px|right]]
:The position or component to update
+
The rotation call allows an object to be [[Object Rotation|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 default value for this parameter is: '''''this'''
 
 
 
[[Variable types|HANDLE]] ''PivotHandle''
 
:An optional position to treat as the origin to rotate around
 
  
[[Variable types|FLOAT]] ''Degrees''
+
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.
:Number of degrees to rotate by
 
  
 +
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.
  
==Return value==
+
If the ''PivotHandle'' is zero the object rotates around its own center.
''This call does not return a value''
 
  
 +
The image to the right shows a cube with it's axis positions identified.
  
==Detailed description==
+
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.  
There are several api calls that deal with rotation of an object and the effects can be quite complex. Here we are going to deal exlusively with the RotateX() api call. An object can rotate around it's own axis(x,y,z), or around the axis of another object's axis(x,y,x) if a different object is named as the pivothandle in the api call.
 
When dealing with rotation in Flowcode it is important therefore to understand the following points
 
  
#Rotation of an object occurs from the centre of an object or group.
+
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.
#The axis orientation of the object or group may well be different from the axis on the system panel(world axis)
 
#The axis orientation of another object if used as a pivothandle could be different from the object to rotate.
 
  
 +
[[file:SIMAPI_Panel_Position_RotateZ_Pic2.png|400px]]
  
[[file:SIMAPI_Panel_Position_RotateZ_Pic1.png|375px|right]]
 
===Rotating around an object's own axis===
 
This technique is the simplest way of rotating an object or group when the type of rotation required is '''not''' relative to any other object or component.
 
The image to the right shows a cube with it's axis positions identified. Note in this context the x,y,z axis is illustrated just to highlight the explanation of technique, it is not representative of the axis position in Flowcode v6.
 
  
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.
+
===See also===
  
The screenshot from Flowcode v6 below shows a cubiod with it's internal axis shown (blue is the Z-axis line), and also a blue 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. Note also incidentally the cuboids axis is also the same as the world axis but this might not always be the case.[[file:SIMAPI_Panel_Position_RotateZ_Pic2.png|800px]]
+
[[Object Rotation]]
  
 +
[[Local and World Space]]
  
 
==Examples==
 
==Examples==
Line 50: Line 57:
  
 
===Flowcode example file===
 
===Flowcode example file===
Download [[File:SIMAPI_Panel_Position_RotateZ_v1.fcf]] and open it in Flowcode v6.
+
Download {{Fcfile|SIMAPI_Panel_Position_RotateZ_v1.fcfx|SIMAPI_Panel_Position_RotateZ_v1}} and open it in Flowcode v6.
 +
 
 +
The sample file {{Fcfile|SIMAPI Panel Position RotateXYZ.fcfx|SIMAPI Panel Position RotateXYZ}} rotates a grouped object around its X, Y, and Z axis.

Latest revision as of 11:41, 16 January 2023

Fc9-comp-macro.png RotateZ
Rotates the object around the Z axis 
Fc9-h32-icon.png - HANDLE Handle
The position or component to update 
Fc9-h32-icon.png - HANDLE PivotHandle
An optional position to treat as the origin to rotate around 
Fc9-f32-icon.png - FLOAT Degrees
Number of degrees to rotate by 
Fc9-void-icon.png - NONE Return


Detailed description

SIMAPI Panel Position RotateZ Pic1.png

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.

SIMAPI Panel Position RotateZ Pic2.png


See also

Object Rotation

Local and World Space

Examples

Calling in a calculation

  • Add to a calculation icon:
    ::Panel.Position.RotateZ(handle, pivothandle, degrees)

Flowcode example file

Download FC6 Icon.png SIMAPI_Panel_Position_RotateZ_v1 and open it in Flowcode v6.

The sample file FC6 Icon.png SIMAPI Panel Position RotateXYZ rotates a grouped object around its X, Y, and Z axis.