transform local euler angles

I am using transform local euler angles to reset the angle of an animated character when it hits the ground. It needs to be local as the character is a child of a rigidbody which follows the surface normal. The problem that I have is that it works sometimes and not others however it always recognizes the collision. I can not see any pattern to work out why. Here is my code:

function OnCollisionEnter(collision : Collision) {      
    var angle : Vector3;
    angle = Vector3(0,270,0);
    playerAni.transform.localEulerAngles = angle;
    print("collide");
}

Any ideas peeps, I am stumped... thanks :)

I have the same issue with localEulerAngles. Sometime the localEulerAngles works as aspect, sometime not, and the problem always occur when I publish as standalone project.

Tonight I discover the problem would occur if I didn’t select any object in Hierachy tab, if I select anything (no necessarily select the rotate object) in Hierachy tab, the localEulerAngles work as desire.

I test on Unity 3.5. It seems it is a bug.

Hey guys

I suuspect the issue is that you expect LocalEularAngle to rotate the objects axis using the parent as a reff to skip coding to worldspace.

in reality this is not what quaterion.Euler or Local.Eular actually do,…

The code to rotate the actual Objects axis is transform.rotate() but this lacks the abilty to clamp the angle

to clamp the angle i Modified the source code and came up with this, the camp is active but need possibly a cut off aswell ill prob do that tomorrow.

//Starts Modified code

public Quaternion RotInput = new Quaternion();

public Quaternion TempRotate = new Quaternion();
public Vector3 TempRotInput = new Vector3();
public Vector3 TempClampL = new Vector3();

Void update()

{

                                 //Left Rotation Begins

                                RotInput = Quaternion.Euler(CameraRotate.x,CameraRotate.y,CameraRotate.z);

                                TempRotate = LeftUpperArm.transform.localRotation ;

                                TempRotate *= RotInput ;

                                TempRotInput = TempRotate.eulerAngles ;
                              
                                TempClampL = new Vector3 ((Mathf.Clamp((TempRotInput.x),LUpperarmXmin,LUpperarmXmax)),(Mathf.Clamp((TempRotInput.y),LUpperarmYmin,LUpperarmYmax)),(Mathf.Clamp((TempRotInput.z),LUpperarmZmin,LUpperarmZmax)));

                                LeftUpperArm.transform.localRotation = Quaternion.Euler (TempClampL) ;

                                //Left Rotation Ends

}

//

Hope this helps any1

Sincerely Exvalid.