JCPalmer Posted May 13, 2016 Share Posted May 13, 2016 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 13, 2016 Share Posted May 13, 2016 Ouch...correct. I'll fix it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.