How to Change position + rotation of a parent while keeping X and Z Rotation

Sooo this question is a problem , a evolution by another solution of this problem here:

How can I change the parents rotation so the childs rotation is looking at a specific direction

Basically:

We have a "Eye" (HTC Vive). We have a "Parent" which is the Parent of "Eye".

We can not change the position or rotation of the Eye in code. We can only change the position and rotation of the Parent.

1.We want to modify the Parent Position so that Eye to goes to a certain "Target 1" position.

2.We want to modify the Parent Y-Rotation so that the Eye looks at a certain "Target 2" position.

3.While doing this we dont want to modify the Parent X or Z , because this would lead to a Rotated game experience.

The Parent Position changes so the Eye gets to "Target 1" position. The Parent Position changes so Y- Rotation should look at Target 2 position The Parent X/Z Rotation should not modify the Eye X/Z

• I started a bounty – OC_RaizW Mar 9 '18 at 12:04

// Construct a scale vector to flatten our directions into the horizontal plane,
// so we only consider the yaw component of the rotation.
var horizontal = new Vector3(1, 0, 1);

// Find which way the eye is pointing in the parent's horizontal plane.
var eyeHeadingHorizontal = Vector3.Scale(eye.localRotation * Vector3.forward, horizontal);
// Find which way we want it to look in the world's horizontal plane.
var lookHeadingHorizontal = Vector3.Scale(target2 - target 1, horizontal);

// Compute a rotation that takes the eye's heading to the desired heading.
parent.rotation = Quaternion.FromToRotation(