Difference between revisions of "Object Rotation"

From Flowcode Help
Jump to navigationJump to search
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This article refers to the representation of an object drawn on either the System panel or the Dashboard panel.  
+
This article refers to the representation of an object drawn on either the [[System Panel]] or the [[Dashboard Panel]].  
 +
__NOTOC__
 +
==Flowcode's representation of rotation==
 +
 
 +
[[File:SIMAPI_Panel_Position_Rotate_Pic1.png|400px|Rotation around the X axis]]
 +
 
  
==Flowcodes representation of rotation==
 
[[File:SIMAPI_Panel_Position_Rotate_Pic1.png|thumb|200px|right|Rotation around the X axis]]
 
 
An object is rotated around an '''axis'''. An axis is the direction an object is facing.
 
An object is rotated around an '''axis'''. An axis is the direction an object is facing.
  
 
If you imagine any object as a cube in shape, then ''aligning'' your view with the objects top or bottom faces is looking at the object in the '''Z''' axis, front and back is along the '''Y''' axis, and left and right sides are the '''X''' axis.
 
If you imagine any object as a cube in shape, then ''aligning'' your view with the objects top or bottom faces is looking at the object in the '''Z''' axis, front and back is along the '''Y''' axis, and left and right sides are the '''X''' axis.
[[File:Eg_Pitch_Yaw_Roll.svg|thumb|200px|right|Position axis as represented in Flowcode]]
 
  
In the front end and API Flowcode works in [https://en.wikipedia.org/wiki/Euler_angles Euler angles], '''Pitch''' for X, '''Yaw''' for Y and '''Roll''' for Z. Internally, Flowcode works with [https://en.wikipedia.org/wiki/Quaternions quaternions], which are calculated by rotating first around Y, then X then Z, Flowcode can easily be altered to use Quaternions in the front end.
 
  
 +
[[File:Eg_Pitch_Yaw_Roll.svg|400px|Position axis as represented in Flowcode]]
 +
 +
 +
In the front end and API Flowcode works in [https://en.wikipedia.org/wiki/Euler_angles Euler angles], '''Pitch''' for X, '''Yaw''' for Y and '''Roll''' for Z. Internally, Flowcode works with [https://en.wikipedia.org/wiki/Quaternions quaternions] to increase efficiency and to work around problems like ambiguity and gimbal lock. Quaternions are calculated by rotating first around Y, then X then Z.
  
 
As convention, Flowcode represents the X axis in red, Y in green and Z in blue.
 
As convention, Flowcode represents the X axis in red, Y in green and Z in blue.
  
 
===Using the properties===
 
===Using the properties===
All the objects in Flowcode have [[Object Coordinates|coordinates]], [[Object Scale|scale]] and '''rotation'''. The [[Properties Pane]] allows all of these to be changed, and rotation can be adjusted in X Y and Z angles.
+
All the objects in Flowcode have [[Object Coordinates|coordinates]], [[Object Scale|scale]] and '''rotation'''. The [[Properties Panel]] allows all of these to be changed, and rotation can be adjusted in X Y and Z angles.
  
 
===Using the API===
 
===Using the API===
 
The rotation calls found in the [[API Panel.Position]] allow an object to be [[Object Rotation|rotated]] around any point in any axis. The point rotated around is called the '''pivot'''.
 
The rotation calls found in the [[API Panel.Position]] allow an object to be [[Object Rotation|rotated]] around any point in any axis. The point rotated around is called the '''pivot'''.
  
Specifying any pivot other than the center of the rotating object will alter the objects coordinates as well as its angle.
+
Specifying any pivot other than the centre of the rotating object will alter the objects coordinates as well as its angle.
  
When specifying a pivot other than the objects center, imagine a solid bar, attached at one end to a fixed pivot point, and the other to the centre of the rotating object. The rotation has the effect of rotating that bar, and therefore the object attached to the other end, around an axis.
+
When specifying a pivot other than the objects centre, imagine a solid bar, attached at one end to a fixed pivot point, and the other to the centre of the rotating object. The rotation has the effect of rotating that bar, and therefore the object attached to the other end, around an axis.
  
 
Each rotation call can specify that pivot to rotate around, and some of the more powerful calls can also specify an axis to rotate in.
 
Each rotation call can specify that pivot to rotate around, and some of the more powerful calls can also specify an axis to rotate in.
  
 
== Local and world space =={{main|Local and World Space}}
 
== Local and world space =={{main|Local and World Space}}
When working with objects in the flowchart, local rotation is always preferred over world space. This is so that rotating an objects parent does not affect the 'coordinate space' of the program - rotating to 90degrees in X will always move your object predictably in relation to other objects in the component, despite the users rotation of the component itself, which is out of the component authors control.
+
When working with objects in the flowchart, local rotation is always preferred over world space. This is so that rotating an objects parent does not affect the 'coordinate space' of the program - rotating to 90 degrees in X will always move your object predictably in relation to other objects in the component, despite the users rotation of the component itself, which is out of the component authors control.
  
 
It is very difficult to program an object to behave as expected in all circumstances using the world position.
 
It is very difficult to program an object to behave as expected in all circumstances using the world position.
  
 
To calculate the world rotation from an objects local rotation, this must be combined with the rotations of all the objects parents in the [[Component Tree]].
 
To calculate the world rotation from an objects local rotation, this must be combined with the rotations of all the objects parents in the [[Component Tree]].

Latest revision as of 07:59, 2 July 2019

This article refers to the representation of an object drawn on either the System Panel or the Dashboard Panel.

Flowcode's representation of rotation

Rotation around the X axis


An object is rotated around an axis. An axis is the direction an object is facing.

If you imagine any object as a cube in shape, then aligning your view with the objects top or bottom faces is looking at the object in the Z axis, front and back is along the Y axis, and left and right sides are the X axis.


Position axis as represented in Flowcode


In the front end and API Flowcode works in Euler angles, Pitch for X, Yaw for Y and Roll for Z. Internally, Flowcode works with quaternions to increase efficiency and to work around problems like ambiguity and gimbal lock. Quaternions are calculated by rotating first around Y, then X then Z.

As convention, Flowcode represents the X axis in red, Y in green and Z in blue.

Using the properties

All the objects in Flowcode have coordinates, scale and rotation. The Properties Panel allows all of these to be changed, and rotation can be adjusted in X Y and Z angles.

Using the API

The rotation calls found in the API Panel.Position allow an object to be rotated around any point in any axis. The point rotated around is called the pivot.

Specifying any pivot other than the centre of the rotating object will alter the objects coordinates as well as its angle.

When specifying a pivot other than the objects centre, imagine a solid bar, attached at one end to a fixed pivot point, and the other to the centre of the rotating object. The rotation has the effect of rotating that bar, and therefore the object attached to the other end, around an axis.

Each rotation call can specify that pivot to rotate around, and some of the more powerful calls can also specify an axis to rotate in.

Local and world space

Main article: Local and World Space

When working with objects in the flowchart, local rotation is always preferred over world space. This is so that rotating an objects parent does not affect the 'coordinate space' of the program - rotating to 90 degrees in X will always move your object predictably in relation to other objects in the component, despite the users rotation of the component itself, which is out of the component authors control.

It is very difficult to program an object to behave as expected in all circumstances using the world position.

To calculate the world rotation from an objects local rotation, this must be combined with the rotations of all the objects parents in the Component Tree.