I am trying to make an object mirror another objects rotation. The two objects have different parents. object3D's .getWorldQuaternion will give me the source objects rotation in world coordinates. How can I translate this to local space for the destination object?
0
votes
1 Answers
0
votes
Its not quite the answer to my question, but here is how I solved my problem.
This will copy copy the entire world transform (including rotation) between objects even if they have different parents
// Copys the world transforms between objects even if the have different parents
var copyTransform = (function()
{
var scratchMat = new THREE.Matrix4();
return function(source, destination)
{
destination.matrix.copy(source.matrixWorld);
destination.applyMatrix(scratchMat.getInverse(destination.parent.matrixWorld));
}
})();
qDestLocal.multiplyQuaternions( qSourceWorld, qDestParentWorld.inverse() );
β WestLangley