Is there a way to set the absolute global rotation of a vector using a quaternion?
Imagine a function called f(v, q)
which rotates vector v
to quaternion q
.
While THREE.Vector3
has a .applyQuaternion
function for applying rotations to vectors, this is a relative rotation. For instance, calling f(f(v, q), q)
applies q
twice instead of the desired result f(f(v, q), q) = f(v, q)
where q
represents the absolute rotation.
I am aware that I can calculate some
deltaQ = currentQ.premultiply(q.inverse())
and then use .applyQuaternion
, but the challenge lies in retrieving the currentQ
or the current rotation of the vector so that it can be reversed and updated with the new quaternion.
Your assistance is greatly appreciated!
UPDATE:
My goal is to rotate around a point specified in world coordinate space, hence the usage of object.worldToLocal
and object.localToWorld
functions. However, when performing these conversions, the rotating object seems to veer off course.