-
Adressing Nth Layer
Hello all,
here is a little problem i am trying to figure out. I am trying to built a self arranging text arrangement. The first layer sits on the left, the second layer in the middle and the third layer on the right side of the screen. The fourth layer would sit on the exact same position as the first layer, the fifth on the position of the second, the sixth on the position of the third and repeating this pattern.
Thing is, this must be dynamic. Say, if i only have layer 1, it should sit on the left. If i duplicate this exact layer (creates a total of 2), it should move to the middle of the screen. If i duplicate any of those two layers (creates a total of 3), it should move to the right. If i duplicate any of these yet again (a total of 4) it should move to the position of the first layer, meaning left side.
I kind of managed to create a code for the position offset.
z1=thisLayer.index-7;
z2=z1*2
x1=transform.position[0];
x2=transform.position[1];
if(z1<2)
{[x1,x2]};
else
{[x1*z2,x2]};However, this will only keep offsetting the position for each additional layer. I wonder if there is a way to have every 4th duplicated layer snap back to the position of the 1st layer.
Sorry if this is confusing, but i hope you guys can help me out.