Local and World Space
This article discusses the difference between the position of an object on the Flowcode panel and how that position appears on screen.
A component position
The position of any object drawn on the panel is defined by three parts:
- A set of coordinates, (X, Y, Z), which define the centre of the object.
- An axis represented by the angles pitch, yaw, roll. These are called Euler angles.
This defines the local position of an object. That is, the position of the object without consideration of any other object on the panel.
This is a useful representation when writing components as the author of the component does not need to concern themselves with how the finished component will be positioned on the users panel.
All other representations of the objects position can be derived from this local position.
The bounding box of the object is exactly the same as its position, except that instead of a scale a size is used instead. This is the scale of the object multiplied by the size of all the child objects.
The size of a leaf object is equal to its scale, as the object has no children to multiply its scale by. Hence the bounding box of a leaf object is the same as its local position.
The local position of an object does not consider the rotation, scale or coordinates of the objects parents. This is useful for working in 'isolation', where the author of a component wishes to be able to set exact positions of their objects without worrying about how the final component is positioned by the user.
When designing and positioning objects using the graphical editor it is often easier to consider a components position in terms of world space, that is the position of the object when all the objects parents are considered.
Flowcode will allow the world position to be controlled through the Properties Panel as this is considered the most intuitive way of picturing the system. However, local position or bounds may be selected individually for coordinates, size and rotation.