BGE copy orientation

I need to copy an objects orientation into a value in python so that I can apply that orientation to another object.

for real dude? there was literally just a post about this.

Yes but I already tried that method and it did not work.

It would be helpful to show how you tried and how it did not work as this is a very simple operation. Just so you know, when you use ‘.copy()’ on the orientation, it only makes a new copy of the object’s orientation on that frame. Without ‘.copy()’ any change to the object you are copying will be applied to the other object until you explicitly change that other object’s orientation.

# obj1 will now always copy obj2's orientation
obj1.worldOrientation = obj2.worldOrientation

# obj1 is set to the orientation of obj2 only on the frame this is called
obj1.worldOrientation = obj2.worldOrientation.copy()

(edited)
Wasn’t thinking straight. A game object won’t maintain that relationship with another game object unless it’s updated so with or without .copy() the effect is the same. On the other hand, a game property or instance variable will maintain it.

That works but I need to be able to make one objects y orientation another objects z orientation.