top of page

Reversing Transforms and Movable Pivots

Let's say I want to set up a movable pivot. Pretty simple, we just need to put a group under the control and multiply the translations of the control by -1 and plug them into the group. That way when you translate the control around all the children of the control stay in place, but when we rotate the control the children rotate around whatever the controls current position is.

But what if I wanted to be able to rotate and translate the pivot? Well there are two problems we have to face now but let's start with one. How do we cancel out the rotations and translations of a control? Now you might think that you can do it using the same method as before, multiplying the rotation values by -1 and plugging them into a buffer group (with the opposite rotation order). You can try that for yourself and or just see the results below.

So that works with translation and it works with rotation but it didn't work with both at the same time, but why? The reason is that the translate, rotate, and scale transforms occur in that order, not all at once. So if we wanted to create a buffer group that canceled out the transforms of the parent we would need to apply the inverse scale, then the inverse rotation (in the opposite rotation order) and then the opposite translation. Unfortunately this requires us to use three different buffer groups, because as in the example above doing it one group would not apply the inverse transformations in reverse order.

But if you've read some of my other posts you can probably guess as to what can solve this problem. It's matrices, specifically inverse matrices. If a matrix represents the translate rotate and scale transformations of an object then the inverse matrix represents the opposite transformations. Specifically it represents the transformations that we would need to go through in translate, rotate, scale order (so we could do it on one buffer group) to in order to cancel out a set of transformations. So below is an example of how to use inverse matrices.

So to clarify what is happening we are using a multiply matrix node to simulate the transforms of a hierarchy. The first object in the hierarchy has the opposite transforms of the green control (opposite as in "coming from the inverse matrix" not "multiplied by negative 1" so the result is not the same as in the first video). The second object in the simulated hierarchy is a child of the first and has the same local transforms as the red control. The third object in the hierarchic is a child of the second object and has the same transforms as the green control (the best way I can explain this step is that it sort of cancels out the transformation of the green control because we also applied the opposite transforms but because the canceled happens after the transforms of the red control are applied the rotation pivot is correct. Kind unintuitive I know.)

I'm probably going to try and do a proof of concept of that spine setup I talked about in the video. I'm not sure if it'll especially applicable but who knows? Maybe there's a character out there that would really benefit from this technique.

Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page