character controller rotation won't accept script values

Hi,
I am trying to set the character controller rotation by script so that the controller will move along that angle on play. I can script the values OK, but when I play the scene, the x and z values of the character controller’s rotation always revert back to 0. Is there any way to work around this? Example code:

var rot : Quaternion = Quaternion.LookRotation(dir);
    this.transform.rotation = rot;

Same thing happens if I set the rotation manually:

this.transform.eulerAngles = new Vector3(10, 45, 150);

On play, the Y value will be 45, but the x and z will revert to zero. Any help will be greatly appreciated.

Have you tried to use transform.rotation?

I discovered the problem. It’s in the MouseLook script, specifically, the line:

transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);

I don’t really understand why, but this code causes the X value of the object to revert to zero when play starts, overriding any scripted value for X. (The Z value is not a factor as that is constant at zero.) I found a workaround by commenting out all the code in the MouseXAndY Axes choice and substituting this one line of code which does not use EulerAngles.

transform.Rotate(-Input.GetAxis("Mouse Y") * sensitivityY, Input.GetAxis("Mouse X") * sensitivityX, 0);

Zaffer