Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Duplicate array script (https://simplymaya.com/forum/showthread.php?t=33395)

garch 07-12-2009 07:21 AM

Duplicate array script
 
Hi,

I'm just getting started with scripting and I'm trying to create a simple script that would duplicate an object i've created in an array. I found a bunch of tutorial on how to create an array of objects with a for loop and I can get as far as that, but when it comes to duplicates, they all appear on top of each other... Here's my script:

// I'll use a sphere for the purpose of this example
//but in reality it is 2 planes grouped together

polySphere;
rename pSphere1 a1;

int $i;
for($i=1; $i<7; $i++){
duplicate a1;
move ($i*2) 0 ($i*2);
}

Any ideas?

Chirone 14-12-2009 10:10 AM

i tried moving an object in 3d space and seeing what it says in the script editor

don't you need to write it as:
Code:

move -r ($i * 2) 0 ($i * 2);
?

NextDesign 14-12-2009 05:52 PM

The -r after move is relative to the last position. -a is absolute, just so you don't get confused :)


All times are GMT. The time now is 03:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018