11. Performing Basic Transformations (Move, Rotate, Scale)

Every node has a transformation matrix, which encodes position, rotation, and scale of the node in the world. If a node is added as a child of another node, it has a transformation matrix that is related to its parent node. That is why the Node class has different functions: getTransform(), setTransform() and getWorldTransform(), setWorldTransform() that operate with local and world transformation matrices respectively. The following code illustrates how to perform basic node transformations:

Project Progress

In our project we are going to apply some transformations to our initial set of objects. So, let us write an auxiliary method called transformNode that will move, rotate and scale a given node. We are also going to use some multiplier (let's call it ifps) as a parameter for this function to scale the transformations. We'll explain it in the next section.

In the AppWorldLogic.h file, we define constants to be used in our transformNode method (speed of objects movement, delta angle of objects rotation), add a variable to store current scaling vector for our objects and declare our transformNode method.