Orientation copy reverses

I am using the cam script provided by Mobius and trying to have the character copy the orientation of the camera. Simply
own.orientation.z = cam.orientation.to_euler.z #pseudocode
However occasionally as I turn the camera around the character model flips it’s z orientation to be facing the camera instead. I have no clue why, given how few lines of code I have. Does it have anything to do with the Euler operation or with the camera script?

try this

own.worldOrientation.col[2] = cam.worldOrientation.col[2]

This sounds a lot like this issue here. The solution posted there may work for you.

Thanks, Mobious, that seems to solve my problem for the z axis. How would you do that to copy the other axis as well?

I don’t think I understand how the issue is happening on multiple axes. Can you post an example of the problem?

sounds like you want the camera to look around, but the player to only match the cameras z rotation?

you can use a ‘mouse look’ actuator for looking around, but remember camera rotates vertically on the ‘y’ axis, while mesh objects use the ‘z’ axis. so you want to match the player.z to the camera.y(if I remember correctly)…and the ‘mouse look’ actuator can do the rest.