Partial rotation copy

I need to copy a just one rotation component from one object to another. I’m c# coder. Let’s say I want Obj2 to have same transform.rotation.y as Obj1. Simple assignment
Obj2.transform.rotation.y = Obj1.transform.rotation.y;
issues an error:

Current approach is to ransfer Quaternion thru mediating object:

Quaternion q = new Quaternion(0.0f, Obj1.transform.rotation.y, 0.0f, 0.0f);
Obj2.transform.rotation = q;

… it doesn’t work for some reason, the y component of Obj2 is always 1.0 or -1.0 (depending on sign of Obj1).
Please, advise.

Have you tried working with the Euler angles? Maybe that will yield better results.

Working with degrees is quite lame, but it works. :slight_smile: Thank You a lot!