How do you check for invalid Quaterion rotations

Hi

I have a script thats causes a Game object to clone itself. The clone attaches itself as a child then clones itself. Each clone is slighly rotated and moved.

While it does not cause the code to break I get this error.

This the offending code.

private function seedCell(  lAngle : float , bName , leafType ) {	

	var clone = Instantiate( Resources.Load( leafType , GameObject ), transform.position, transform.rotation );		
	
	clone.GetComponent(glife).lSize = this.lSize * 0.98;
	clone.GetComponent(glife).count = this.count + 1;
	clone.transform.name = bName;
	clone.transform.parent = transform ;
	clone.transform.localScale = Vector3( 0.001, 0.001, 0.001 );
    clone.transform.localEulerAngles.y = lAngle/2;
    clone.transform.localEulerAngles.z = lAngle;
    clone.transform.localEulerAngles.x = straightAngle;
    clone.transform.localPosition.x = 0;
    clone.transform.localPosition.y = 0;
    clone.transform.localPosition.z = lSize* 0.6;
    
}

I am not sure if error causes a problem but I think it may slow the code down.

Anyone have any clues how to fix this.

Thanks

Just a wild guess, but you might try using

clone.transform.localEulerAngles = Vector3(straightAngle, lAngle/2, lAngle);

since eulerAngles can sometimes go weird if you set the axes individually. Generally you should set them all at once.

–Eric

Just tried your suggestion Eric. It did not solve the problem. Thanks for replying.

The problem was fixed by upgrading to 2.5 .

Makes me very happy. lol