GameAnimationProgramming
GameAnimationProgramming copied to clipboard
`Transform::combine` is not robust.
Not any two Transforms can be combined into one.
For instance, you can't combine these two:
Tranform(vec3(0, 0, 0), angleAxis(45.0f * QUAT_DEG2RAD, vec3(0, 0, 1)), vec3(1, 1, 1))
Tranform(vec3(0, 0, 0), quat(), vec3(1, 0.5, 1))
To illustrate, here's an example of applying these two Transforms to an axis-aligned square with the origin in the center:
So
Transform::combine doesn't give the expected result in this case.
Possible solutions:
- Either narrow the definition of
Transformto prohibit non-uniform scales:
struct Transform {
vec3 position;
quat rotation;
float scale;
- Or the opposite: widen the definition:
struct Transform {
vec3 position;
mat3 linear;
- Or give up the idea of implementing
Transform::combineat all.