Object Rotation

From Flowcode Help
Revision as of 21:56, 22 May 2013 by JonnyW (talk | contribs) (Created page with "This article refers to the representation of an object drawn on either the System panel or the Dashboard panel. ==Flowcodes representation of rotation== [[File:SIMAPI_Panel_...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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

Flowcodes 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.

File:Coordinate axis.svg
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.

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 Pane 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 center 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.

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 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.

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.