Hello,
I’m trying to get a cube (grey) to copy a rotation of another cube (purple), but to only restrict the rotation on the Y axis.
This is what I mean;
The Grey cube is only allowed to rotate on its ‘y’ axis. The Purple cube is allowed to rotate on all. I want to be able for the grey cube to rotate only in the direction-z of the purple, but locked on the Y axis.
As you can see here, the purple cube is actually rotated downwards. But the grey cube is not - but still facing the direction of the Purple cube with regards to its Z-direction, but respecting only its Y rotation.
–
This is what I would like to attempt, however it doesn’t actually run like this. This is my code;
float _rotationAngle = _target.eulerAngles.z;
transform.eulerAngles = new Vector3(0, _rotationAngle, 0);
How can I achieve this? Thanks.