Hi community!
I've been failing to use Quat4f in a robust manner now several times. I just
want to do an interpolation of orientation. Most of the time, the results
seem to be OK, but sometimes using Matrix4f#setRotation(Quat4f) leads to
totally distorted results.
I suppose it has to do with my not-so-good understanding of quaternion math.
But how do I have to setup quaternion solutions that deliver a rocksolid
result? Where's my mistake?
Are there better ways to do so? Interpolate an axisangle? Somehow?
Here is the code I use e.g.
1 2 3 4 5 6 7 8 9 10
| private final Quat4f mSrcOrientation = new Quat4f(); private final Quat4f mDstOrientation = new Quat4f();
....
data.position().get( mSrcOrientation ); mLocData.position().get( mDstOrientation ); mDstOrientation.interpolate( mSrcOrientation, dt / mTime );
data.position().setRotation( mDstOrientation ); |