- Home /
controlling scale of an object via the scale of another obect
hi i am trying to control the scale of a cue with the scale of two other cubes here is what i am trying. at this point i am newbSmacked by its not working. am i not getting the scale values properly? am i not setting the value correctly?
public Transform clarity ;
public Transform capacity ;
public Transform cost ;
void Update ()
{
Vector3 clarityScale = clarity.localScale;
Vector3 capacityScale = capacity.localScale ;
float newScale = (clarityScale.y + capacityScale.y)/2;
Vector3 tempScale = cost.localScale ;
tempScale.y = newScale;
cost.localScale = tempScale ;
}
thanks for your help.
Comment
That looks okay. Is the script attached to anything in the scene? Do you see any warnings or errors in your console window?