Hi Chris.
Just want to report what I believe to be a curious optimization I found.
I was rotating an Object using the 'Object > Transform > Rotate' By Action.
Then I found that at some point is was gimbal locking!
So I looked at the source and found this in ActionTransform.cs
else if (transformType == TransformType.Rotate)
{
if (toBy == ToBy.By){
int numZeros = 0;
if (targetVector.x == 0f) numZeros ++;
if (targetVector.y == 0f) numZeros ++;
if (targetVector.z == 0f) numZeros ++;
if (numZeros == 2){
targetVector = SetRelativeTarget (targetVector, isSkipping, linkedProp.transform.eulerAngles);
}else{
Quaternion currentRotation = linkedProp.transform.localRotation;
linkedProp.transform.Rotate (targetVector, Space.World);
targetVector = linkedProp.transform.localEulerAngles;
linkedProp.transform.localRotation = currentRotation;
}
}
}
Always using quaternions, even if rotating over 1 axis solved the problem. Are there any serious (performance) implications of me turning this optimization off?
Comments