View Full Version : particle current time instance offset
08-18-2008, 09:31 PM
I would think there is already a post on this somewhere but I can't find it. Can you control the current time on a per particle basis? Basically to and variation to when an instance particle starts its animation? I understand MEL just fine so throw it at me, I've yet to get this one working in Maya.
08-20-2008, 07:35 AM
Hmm... any chance you could clarify what you are trying to do? Im going to assume you are working with the particle instancer? If thats the case and you want each instance to start at a different frame, you can add your own PP attribute to the 'object Index' in the instancer dialog. For an example, lets say you have a pack of running guys, and your animation loop is 24 frames...
On your particle, create a PP attribute called objIndex.
In the particle instancer, set "Object Index" to objIndex.
In the creation expression add the line:
objIndex = (int) rand(24);
In the runtime expression add the line:
objIndex = (objIndex + 1) % 24;
Let me know if I even came in the ballpark of what you are trying to do, and best of luck...!
08-20-2008, 01:55 PM
Hey Mike, thank you for the reply...Yeah thats pretty much what I'm trying to do. I already had the creation expression like you said (which is just to grab different instances). I'm trying to avoid making, say 30 copies and offsetting their animation by hand.
Here's my creation expression I had..which works..what does the runtime one do?? I'll give it a go.
if (frame==3) seed(100);
particleShape1.randIndexPP = rand(0,3);
08-20-2008, 06:49 PM
Ahh, I get you. You will have to have a bunch of duplicates for sure, but they will be static, un-animated duplicates...
Again assuming your main character is a 24 frame run cycle, you will need to duplicate a baked character for every frame of the cycle. (IE: 24 static models, each representing a frame of animation)
You can create a pretty simple MEL to make the work easier.
//Select your character and put it in $obj
$obj = "runningGuyModel";
//start at frame 1
setAttr time1.outTime 1;
//loop over the number of frames in the run cycle
for ($count = 1; $count <=24; $count++)
rename ("pose" + `currentTime -q`);
The runtime I posted earlier is so that each instance will cycle correctly. The % symbol takes the value from the left of it, divides it by the value to the right of it, and outputs the remainder. for example:
1 % 3 outputs 1
2 % 3 outputs 2
3 % 3 outputs 0
4 % 3 outputs 1
5 % 3 outputs 2
Is this getting you any closer to a solution?
08-20-2008, 07:08 PM
Ah i see what your getting at...lol man, that is such a destructive workflow though. I was trying to avoid that, because we still have lots of client revisions on the way....basically without saying too much about the project (because I can't), its for a forrest of growing tree's.
I have the basic animation worked out, but I know it will change....I was hoping to just add offsets, something that should be simple. Oh well, hopefully our pipe switches to Houdini soon, this is a no brainer in there. Thanks a ton for looking into it, much appreciated.
08-20-2008, 10:14 PM
This would be the sort of thing Houdini would rock at for sure. I've used this particle instancer trick for a few different things... Armies,bugs, birds...all sorts. It's not too bad to make animation changes to the original animation if you have some scripts made, but then again, I've never had a client breathing down my neck requiring changes in real time.
I checked out Radium's site... Some very sweet looking commercial work :)
Best of luck,
08-20-2008, 10:14 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.