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

From Flowcode Help
Jump to navigationJump to search
Line 29: Line 29:
  
 
==Detailed description==
 
==Detailed description==
An object can [[Object rotation|rotate]] around any axis. This has the effect of altering the '''pitch''' of the object - in terms of an aeroplane this makes the plane climb or bank.
+
[[file:SIMAPI_Panel_Position_Rotate_Pic1.png|375px|right]]
 +
The rotation call allows an object to be [[Object rotation|rotated]] around any point in the target objects local X axis. This has the effect of altering the '''pitch''' of the object - in terms of an aeroplane this makes the plane climb or bank.
  
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. if no PivotHandle is specified the object will rotate in its own [[Local and world space|local]] space.
+
The handle must be a valid handle to a component, or a quoted (string) name of an object that can be selected on the panel.
  
When dealing with rotation in Flowcode it is important therefore to understand the following points;
+
The '''Pivot''' 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.
 
 
[[file:SIMAPI_Panel_Position_Rotate_Pic1.png|375px|right]]
 
===Rotating around an object's own axis===
 
  
{{Main|Object rotation}}
+
If the Pivot is zero the object rotates around its own center.
  
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 '''axis''' is the alignment to rotate around. Specifying zero will cause the object to rotate around its own axis.
  
 
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.  
 
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.  
Line 46: Line 44:
 
Calling the simulation api '''Panel.Position.RotateX(MyCube,MyCube,1)''' will rotate the object in one-degree steps along it's X-axis as shown by the red rotation arc. To rotate the cube in a counter direction simply specify a negative number for the degrees parameter.  
 
Calling the simulation api '''Panel.Position.RotateX(MyCube,MyCube,1)''' will rotate the object in one-degree steps along it's X-axis as shown by the red 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 cubiod with it's internal axis shown (red is the X-axis line), and also a circle that cuts right through the cuboid's X-axis (see example section below for links to the file) When the program runs the cuboid rotates along it's X 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_Rotate_Pic2.png|800px]]
+
The screenshot from Flowcode v6 below shows a cuboid with it's internal axis shown (red is the X-axis line), and also a circle that cuts right through the cuboid's X-axis (see example section below for links to the file) When the program runs the cuboid rotates along it's X 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_Rotate_Pic2.png|400px]]
 +
 
 +
 
 +
===See also===
  
===Rotating around another axis===
+
[[Object rotation]]
The principles here are identical to rotation around an objects own axis. Imagine a solid bar, attached at one end to a fixed ''pivot'' point, and the other to the centre of the rotating object.
 
  
This call has the effect of rotating that bar, and therefore the object attached to the other end, around the fixed objects X axis.
+
[[Local and world space]]
  
 
==Examples==
 
==Examples==

Revision as of 22:17, 22 May 2013


<sidebar>API contents</sidebar> Rotates the object around the X axis

Class hierarchy

Panel

Position
RotateX

Parameters

HANDLE Handle

The position or component to update
The default value for this parameter is: this

HANDLE PivotHandle

An optional position to treat as the origin to rotate around

FLOAT Degrees

Number of degrees to rotate by


Return value

This call does not return a value


Detailed description

SIMAPI Panel Position Rotate Pic1.png

The rotation call allows an object to be rotated around any point in the target objects local X axis. This has the effect of altering the pitch of the object - in terms of an aeroplane this makes the plane climb or bank.

The handle must be a valid handle to a component, or a quoted (string) name of an object that can be selected on the panel.

The Pivot 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 Pivot is zero the object rotates around its own center.

The axis is the alignment to rotate around. Specifying zero will cause the object to rotate around its own axis.

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.RotateX(MyCube,MyCube,1) will rotate the object in one-degree steps along it's X-axis as shown by the red 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 (red is the X-axis line), and also a circle that cuts right through the cuboid's X-axis (see example section below for links to the file) When the program runs the cuboid rotates along it's X axis. Note also incidentally the cuboids axis is also the same as the world axis but this might not always be the case.

SIMAPI Panel Position Rotate Pic2.png


See also

Object rotation

Local and world space

Examples

Calling in a calculation

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

Flowcode example file

Download File:SIMAPI Panel Position RotateX v1.fcf and open it in Flowcode v6.

The sample file File:SIMAPI Panel Position RotateXYZ.fcf rotates a grouped object around its X, Y, and Z axis.