I'm encountering a bug where I'm trying to synchronize the rotations of two objects by copying the Quaternion
from one object and applying it to another. However, I'm having trouble getting the rotation to be applied to the second object.
In this scenario, object 1 is represented as msh
and object 2 is represented as msh2
. The following code snippet fails to apply the rotation of msh
to msh2
:
var rot = new THREE.Quaternion().copy(msh.rotation);
msh2.rotation.copy(rot);
You can observe this issue in the provided Stack Snippet which showcases the problem in a minimal reproducible form (although it may not match the exact code structure used in my actual project).
// JavaScript code here
<script src="https://cdn.rawgit.com/mrdoob/three.js/dev/build/three.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<canvas id="can" width="400" height="300"></canvas>
Check out the JSFiddle for a visual representation.
I'm puzzled by this situation. I frequently perform similar operations with Vector3
without any issues, so I'm unsure why it's proving challenging in this case...