Transformation order problem: rotation vs scale

While working on my Gothic style windows I discovered a strictly mathematical problem. I have a skeleton bone which I need to scale in one dimension and then rotate it. The problem is rotation is performed before scale so dimension-wise scaling is not possible, the result is scalar scaling with shearing instead.

Let’s say I want to apply a scale of [sqrt(2), 1, 1] then rotate an object by 45 degrees counter-clockwise around the Y axis, what results in a quaternion vector of [-0.8733046, 0, -0.4871745, 0]. If scale was applied first the result would be correct, but this is not the case and the resulting transform is not isometric in starting Y and Z dimensions.

I’m not much into transform matrices but if I understand the basics correctly in such system it is entirely impossible to perform dimension-wise scaling (if rotation is applied there’s no way to avoid shearing). Is there any chance to change that?

1 Like

I remember @malley talking about this in a stream. Maybe he can help.

1 Like

Hmm, I’m barely understanding what you’re saying - but I do know that scale should happen before rotation, that same problem has been causing huge issues with my rigs : /. But, for in-game stuff, we should ask @not_owen_wilson - do you know what’s going on here Chris?

1 Like

In fact you don’t need to understand anything else, the rest is about the fact that if we use quaternion spatial rotation model then applying scale first is absolutely necessary (if both rotation and scale were stored as 3x3 matrices then a workaround would exist, but with scale as a 1x3 vector and rotation as a 1x4 quaternion vector there is no other solution than to change transform order, because the workaround involves dividing matrices and you cannot divide vectors longer than 1x1).

I think this has been fixed in our internal branch. Did you get to check it, @malley? :thinking:

Heh, you beat my memory @Relyss. @Pawel_Malecki - yep, Chris fixed it yesterday, but it wont come out until A23 ships. (Though you should get it sooner if you play on unstable like always.)