mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix animation blending
This commit is contained in:
parent
a5180fbb28
commit
c7c99296cb
6 changed files with 42 additions and 53 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "irrMath.h"
|
||||
#include <matrix4.h>
|
||||
#include <variant>
|
||||
#include <vector3d.h>
|
||||
#include <quaternion.h>
|
||||
|
||||
|
@ -27,12 +26,23 @@ struct Transform {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
Transform interpolate(Transform to, f32 time) const
|
||||
{
|
||||
core::quaternion interpolated_rotation;
|
||||
interpolated_rotation.slerp(rotation, to.rotation, time);
|
||||
return {
|
||||
to.translation.getInterpolated(translation, time),
|
||||
interpolated_rotation,
|
||||
to.scale.getInterpolated(scale, time),
|
||||
};
|
||||
}
|
||||
|
||||
matrix4 buildMatrix() const
|
||||
{
|
||||
matrix4 T;
|
||||
T.setTranslation(translation);
|
||||
matrix4 R;
|
||||
// TODO this is sussy. probably shouldn't be doing this.
|
||||
rotation.getMatrix_transposed(R);
|
||||
matrix4 S;
|
||||
S.setScale(scale);
|
||||
|
@ -41,4 +51,4 @@ struct Transform {
|
|||
};
|
||||
|
||||
} // end namespace core
|
||||
} // end namespace irr
|
||||
} // end namespace irr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue