Pages

Wednesday, April 12, 2006

XP: distribute position evenly

Just play around with XP, discover a way to distribute some object position evenly, there should be some other easy way with using variable, but this is what I can think of...:)

This script will need 5 cube, using calculation to locate the length between the first cube and the last cube, than divide the length evenly to fit the other cube, here are the script...

distanceX=cube05.Position.X-cube01.Position.X; distanceY=cube05.Position.Y-cube01.Position.Y; distanceZ=cube05.Position.Z-cube01.Position.Z; cube02.Position.X=(cube01.Position.X+(distanceX/4)*1); cube03.Position.X=(cube01.Position.X+(distanceX/4)*2); cube04.Position.X=(cube01.Position.X+(distanceX/4)*3); cube02.Position.Y=(cube01.Position.Y+(distanceY/4)*1); cube03.Position.Y=(cube01.Position.Y+(distanceY/4)*2); cube04.Position.Y=(cube01.Position.Y+(distanceY/4)*3); cube02.Position.Z=(cube01.Position.Z+(distanceZ/4)*1); cube03.Position.Z=(cube01.Position.Z+(distanceZ/4)*2); cube04.Position.Z=(cube01.Position.Z+(distanceZ/4)*3);

Anyone found better way to achieve the same task, please let me know...

No comments: