I’m trying to make a game object move with my cameras rotation. but if I were to parent it I would get unwanted movement. How can I make it so it only rotates around one axis and not the others.
untiy just tells me that object.transform.rotation.y is not a variable and therefore cannot be modified
please help i have the same problem
Object1.transform.rotation = Quaternion.Euler(Object1.transform.eulerAngles.x, Camera.main.transform.eulerAngles.y, Object1.transform.eulerAngles.z);
Edit: eulerAngles as correction of Hellium
Simple answer, call one transform at the top of your script(this will be the transform that you attach this script to) then call another transform at the top of your script(this will be the transform that you will rotate this’ object’s transform to) then simple say Transform1.transform.rotation = Transform2.transform.rotation; (make sure to put that in an Update function)
Here is what you need to do. If you want the two object to have the exact same y rotation, you need to do something like this: Object1.transform.rotation.y = Object2.transform.rotation.y;