I am using the standard LookAt script:
var target : Transform;
function Update () {
transform.LookAt(target);
}
and am getting some really weird behavior. The object I have it on is getting totally warped out of shape - becoming a huge, long pole-like shape as soon as I run the game. With the above script turned off the object’s shape is fine. (Oddly, the object’s scale etc. info in the inspector does not change!) Has anyone run into a problem like this? The obect is a child of a parent object that is rotating, if that helps…
Most likely one of the parents has non-uniform scale, thus it will scale the child geometry with that scale distributed into the child?
Thanks for responding, but I am afraid I don’t really get that. What qualifies as a “non-uniform scale” and how would I fix that? Also, I don’t understand why “lookAt” would affect scale…
Is the object that is looking a child of another object? does the other object have a scale that is not equal on all three axes? If so that will distort the mesh. To fix it either unparent the object that it looking or make it’s parent have a scale of something like 1, 1, 1.
Ah. The light comes on - though I still don’t get why it is only affected when the lookAt script is on. But fixing the problem is good enough for me. Thanks guys.