Object Rotation

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

Flowcode's representation of rotation

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.

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.