How do I make obj1.transform.position.y = obj2.transform.rotation.y

I cant seem to get this one. I know it has something to do with putting transform.position into a temp variable. All I want to do is use the value of the rotation y of obj2 and make obj1’s position y always the same value. Any advice will help, thanks

void Update () 

	obj1.transform.position.y = obj2.transform.rotation.y;

You can’t change just the y, you need to reassign it:

obj1.transform.position = new Vector3(obj1.transform.x, obj2.transform.rotation.y, obj1.transform.z);

Note that rotation is a Quaternion, if you are looking for the rotation vector, use transform.eulerAngles.

Thanks! That’s it. Quaternions are confusing :confused: