Ok, if it is late now then you want to save your project and go to sleep. Understanding vectors is no trivial feat and needs to be understood properly.
Let’s hide the GLCube1 we created earlier so we can concentrate on the GLLines1 object.
- Select GLCube1 in the scene editor and set the visible property to False
The GLCube1 has now disappeared from view.

Before we can play with vectors we first need to understand what a vector is.
That’s all. Just stretch your arm out and point somewhere. Your arm now forms a vector defining a precise direction. If we were to measure the X,Y and Z coordinate of the tip of your finger relative to your shoulder then we would have an exact definition of the direction your arm is pointing.
Therefore a vector is defined by an X,Y and Z value in a similar way as the position is defined by X,Y and Z

To stick with the hand pointing example, That vector could define a compass heading (TurnAngle) and how much up or down the direction is (Pitch)
However to perfectly define the orientation of a 3D object in space we need to define the objects angle relative to all three axis. Rather than managing three indiscriminate angles GLScene uses two vectors to define the orientation of an object.
The Direction vector defines where the object is pointing at. By default the direction of an object is in the Z axis. The direction vector manages the TurnAngle of the object and the PitchAngle.
The Up vector defines where “up” is. By default the Up vector is aligned with the Y axis. The Up vector manages the RollAngle and PitchAngle.
Enough talk. Let’s try to visualize this.
- Select GLLines1 in the SceneEditor and press F10 to bring up the object inspector
- Set “Show axis” to True in order to see the axis of the coordinate system
- Select the GLDummyCube in the Scene editor and set it’s “ShowAxis” property to True.

As you can see the default Direction vector points into the screen being the Blue Z axis in our example you can assume the roof of the house shape to be the arrow pointing in the the same direction as the Direction vector.
Before we change anything, check out the Up vector values as well.

As suggested earlier, the Up vector points along the Y axis.
Ok, now bear with me. Earlier on in the tutorial I suggested that every object has it’s own coordinate system. I even dared to claim that this is a good idea. Let’s explore this concept now.
The master of the scene (universe) is the Scene Root object. We can assume this to contain it’s own absolute world coordinate system. Within this scene we have a Light, a camera, a cube, a dummy cube and a Lines object. Each with it’s own coordinate system.
But!!! We haven’t messed with the orientation if the individual coordinate systems yet so they are all nicely aligned with each other. For all intense and purposes they are the same.
All coordinate values defined for an objects position direction vector or Up vector are defined in the objects parents coordinate system. So all the coordinates used for GLLines1 are relative to the “Scene root” master coordinate system because GLLines1 is a direct child of Scene root.
Changing the direction vector of an object causes the orientation of that objects coordinate system to change. The nodes, vertexes or points of any 3D object in GLScene are relative to that objects coordinate system. But we define the direction vector in terms of X,Y and Z! so do they change too?
The answer here is NO. Because Position, direction and Up vector are defined relative to the parents coordinate system.
Don’t fully understand this? Not unexpected. Try the following exercise. It may shed some light on this matter.
- Select GLLines1 in the scene editor and press F10 to bring up the object inspector
- Change the Direction.Y value to -1
Although you entered -1, they value instantly changes to -0.7071068

Why is that? The absolute value of a direction vector does not matter since all we care about is the direction in which it points. GLScene makes use of “Normalized” vectors. These vectors are automatically resized to be exactly 1 unit long.
We have turned the direction vector downwards (relative to it’s parents coordinate system) by entering -1 as an Y value. The Z value of 1 and Y value of -1 were recalculated to normalize the length of the vector back to 1 and the result is that Y = - 0.7071068 and Z = 0.7071068

As you can see the Blue Z axis from the GLLines1 object is now pointing down. Now, make a guess. If you change the Position.Y coordinate. Where is the GLLines1 shape going? Straight up along the parents coordinate system (As shown by the dummy cube axis) or Up and forward along it’s own Y axis?
Why not just try it.
- Select GLLines1 in the scene editor and press F10 to bring up the object inspector
- Change the position.Y value to 0.5

Indeed, the shape went straight up because the GLLines1 position coordinates are expressed relative to it’s parents coordinate system. Let’s go one step further and see what happens when we add a Cube as a child of the GLLines object.
- Select GLLines1 in the scene editor and add a Cube object

Make sure that the GLCube2 is a child of the GLLines1 as shown

You can drag and drop object in the scene editor to redefine Parent child relationships.
Wow, see this? The GLcube2 automatically aligned with the GLLines coordinate system!

Let’s have a look at the Up vector which should have a default value of Y=1.
- Select GLLines1 in the scene editor and press F10 to bring up the object inspector

Indeed, the Up vector points straight up. This value is relative to the cubes parent coordinate system which is owned by GLLines1.
Now enough wow stuff. We are going to delete GLCube2 from the scene.
- Open the scene editor, select GLCube2 and delete it
We set out to re-orient the house shape so it would point up. You should now posses the knowledge to do this.
Indeed. Set the direction vector of GLLines1 as shown below and while you are at it. Set the Position Y value back to 0

The result is a GLLines with a direction vector pointing up along the Y axis

This brings us to the end of this tutorial. In this tutorial we have learned to place objects in a coordinate system, manage their orientation and get some appreciation of the concepts of parent and child coordinate systems.
At this point you should be able to build applications that use basic geometry, do basic lighting of the scene and manage position and orientation of your objects in design-time and of course at run-time.
You may have noticed the PitchAngle, RollAngle and TurnAngle properties on GLLines1. This is another way to manage an objects orientation but as you will see in the next topic it is not the best way.