Trying to rotate my character to face a certain point with a quaternion though he jitters as if overshooting the required rotation and having to rotate backward and forth.
Here's my code:
//Get Direction to target
Vec3 oNewDirection = a_oTargetPosition - GetWorldTranslate();
oNewDirection.Normalize();
//Get axis perpendiculr to forward dir and target dir to rotate around
Vec3 oRotationAxis = m_oDirection_Forward.Cross(oNewDirection);
Example...
The original dot product between the forward and new direction will equal:
0.99895191
The dot product between the new forward (after rotation is applied) and new direction then equals:
0.99904567
So it rotate towards but doesn't end up snapping to the new direction, the dot product should equal 1 after...
EDIT: Solved, wasn't normalizing the rotation axis result of the cross product.