Unless I am interpreting what the gradient arg to Matrix.Lerp wrong, it seems to go backwards. I changed it to this:
public static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix {
var result = Matrix.Zero();
for (var index = 0; index < 16; index++) {
result.m[index] = startValue.m[index] + ((endValue.m[index] - startValue.m[index]) * gradient);
}
return result;
}
The higher the gradient, the closer to endValue, right? The process before was:
result.m[index] = startValue.m[index] * gradient + endValue.m[index] * (1.0 - gradient);
The title of the last PR was fixing Lerp. I really thought this was a great improvement. I could never get the bone interpolater I am working on with the now DecomposeLerp. The new one is also much faster.
But, if 10 was a start value, 20 the end, & .2 the gradient, then the answer should be:
10 + ((20 - 10) * .2) or 12, not
(10 *.2) + (20 * (1 - .2)) or 18