Quaternion jr = Quaternion.LookRotation(…); // some normalized vectors
Quaternion q2 = jr * Quaternion.AngleAxis(val, Vector3.right) * Quaternion.Inverse(jr);
Quaternion orgRot = q2 * orgRot;
now… orgRot.w is getting bigger and bigger every time and soon the other components do the same until everything overflows (float positive infinity) and then everything crashes…
why? what’s wrong? and what can I do against it?.. isn’t there a way to “normalize” such things? “rounding” quaternions to useful values or something??
You might be running into floating point accumulation issues if you keep re-using orgRot over and over again.
In general, you want to avoid re-using quaternions (and vectors and matrices and anything that uses floats) unless you calculated it from the beginning or normalized the results. That will ensure the orgRot quaternion is stable.
but someone told me, that quaternion multiplication (in unity) does normalize them? is that not true? … how can I normalize them? I thought normalization is multiplying every component (w, x, y z) by the same factor so that in the end sqrt(w^2+x^2+y^2+z^2) == 1 … is that correct? …
Edit: ok, I’m anwering myself… yes, it seems to be correct… and the multiplication seems not to normalize them