[SOUND]. So transforms are great because. And in fact everything if we do a transloate it will move everything we draw after but what if we do one translate after another like this. Well the most obvious thing that happens is that we move and move again. But what exactly is happening there. When we call the translate command. Everything after the call back command is affected by the translate including any other translates we do. So, if we look at the second the second translate that's a movement of any object that have. But that is also affected by the first translate, the first translate and its, and its mean to the first translate will happen to the second translate and the starting point is 0 by 0 point of the second translate will be affected that of the first translate. So. What happens is that you, the effect of the fir, of the first translator is applied to the second translator. Which, kind of feels more naturally like saying that well The second translate is actually happening first. Instead of happening to the object, and then it's going to be translated by the, by the [UNKNOWN] first translate. We often think of translates, transforms happening in the opposite order. So what happens if we do a translate followed by a rotate? Well, the rotate spins around, that's fine. But if we've got a translate happening before that rotates. Then we're going to have a movement applies to the 0, o point of our rotate. So the 0-0 point of the rotate is going to be moved. in much the same way as we just saw with the 2 translates. They're applying one after the other. And it's kind of like they're playing backwards. But what if we do it the other way around? Well, we put a translate and movement. And then put a rotate applies to the zero zero point of that translate. What happens is that the zero zero of the translate. Is rotated relatively to the 0 0 point of the screen. So actually we're it's like, I'm taking an object arms length and translate it and then I spin it around. So it's spinning from the starting point of the translate. Not through the center of the object. So doing those two transforms in different orders has a radically different effect. If I or for example this bottle of water, if I apply the translate first rotate second which basically means the other way around. I would take and I would translate Well, I would take something and then I translate. I move out. But if I do it the other way around, then I translate first and then I rotate. And I'm making, the rotate isn't just a simply spinning around the center of the object. It's actually a big movement in space. So the first thing to remember is that you kind of think of them in the opposite order if you have to think about transforms it makes more sense to think they're happening backwards but the other thing to think about is is well, what if I want to move 2 objects. Well, if you want to move them together, that's easy, we can translate. But what if you got to move them separately. very often you'll have two objects, the same two cars, two crates, whatever and you just want, want to move one [UNKNOWN] to move the other. If I'm applying a translate. Then, everything that happens after that translation is going to be affected by it. So I translate the first object the circle here then the square is also going to get affect but if I want to move it independeantly. Well we use a command a called push matrix and pop matrix I won't go into the mathematical details, but transforms are implemented using a bit of maths called a matrix And when it call upon the pushMatrix, we're basically creating a new matrix that we're adding all our new transforms to. When we call popMatrix, any transforms that we've added since we added push, pushMatrix. [INAUDIBLE] will get canceled, because we're removing that matrix. So push matrix and pop matrix are a way of limiting the effect of transforms. Any, in fact, transforms that happen after push matrix will automatically be removed, once you call pop matrix. that [INAUDIBLE] gives you a nice way. Of independently moving objects. You pushmatrix, you do whatever transforms you like, you draw the object and then you pop matrix. Then the next object, you do exactly the same thing, pushmatrix, transform it, draw it and then pop matrix. [MUSIC] [MUSIC]