Keeping Rotation of one Axis and aligning others to Parent
<p>I have a problem keeping one axis locked. I have two tools I can use to grab this mock-up needle like object.</p>

<p><a href="https://i.stack.imgur.com/mqwxR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mqwxR.png" alt="Tool grabbing &quot;needle&quot;"></a></p>

<p>I just need to be able to keep its rotation around itself (local y) and align the rest with the tool's rotation. Currently, however, I can only figure out how to rotate all the axes like so:</p>

<p><a href="https://i.stack.imgur.com/OAtOA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OAtOA.png" alt="Tool having grabbed &quot;needle&quot;"></a></p>

<p>The code just looks like this:</p>

<pre><code> case 1:
 this.transform.rotation = leftParent.transform.rotation;
 this.transform.SetParent (leftParent);
 break;
 case 2:
 this.transform.rotation = rightParent.transform.rotation;
 this.transform.SetParent (rightParent);
 break;
</code></pre>

<p>What i have tried:</p>

<ul>
<li>Using .Set on both local and global rotation, keeping the y and/or the w rotation</li>
<li>= new Quaternion as local and global rotation, keeping the y and/or the w</li>
<li>Rotating the needle after matching the parent rotation</li>
<li>Rotating the needle after parenting it</li>
</ul>

<p>Please let me know if there's something obvious I have missed. Thanks!</p>