Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Scirpt help Please (https://simplymaya.com/forum/showthread.php?t=25556)

n8vfx 22-03-2007 02:59 PM

Scirpt help Please
 
Sorry to bother you guys with this but can you tell me what I am doing wrong? I am trying to get what ever geometry I have selected to instance its self every of many frames. Here is the scrpit,

global proc nhGeometryInstancer ()
{

//Declare the variables

string $objSel[];
int $rateOfFire;
int $time;
int $dupFrame;
int $fps;
int $count;


$objSel = `ls -sl`;
$rateOfFire = 5;
$fps = 24;
$time = `currentTime -q`;
$dupFrame = $rateOfFire / $fps;
$count = 1;

if ($time = $dupFrame * $count);
{
instance $objSel;
$count ++;
}
}



As I am sure you can tell I am kinda new to mel so any help would rock.

-nathan

kbrown 22-03-2007 05:13 PM

I'm not really sure what exactly are you trying to do here? Since you don't have any looping going on in your code I got to ask are you really trying to create a script or an expression? Can you try to explain your problem in bit more detail, please?

Xander-0 22-03-2007 06:00 PM

Well, I think I can tell you what your first problem is. The "=" in 'if ($time = $dupFrame * $count);' should actually be a "==" - the singe '=' is used for assigning values, while the double '==' is used for comparing them. Also, I'm not sure you're supposed to have a semi-colon at the end of the same line.
Without actually running the code, that's what stands out to me as being the most in trouble. Although there's certainly a number of things you could do to improve and tighten your code, to simply make it run that may be enough.

n8vfx 23-03-2007 04:51 AM

Quote:

Originally posted by kbrown
I'm not really sure what exactly are you trying to do here? Since you don't have any looping going on in your code I got to ask are you really trying to create a script or an expression? Can you try to explain your problem in bit more detail, please?

Sure. What I am trying to do is have a piece of geometry instance itself over time. That is where the "rate of fire" vaiable comes in. I would like to make something like a partcle generator but geometry instead. I know I could just use a partcile emiter and make it instance my geometry but I want it to be rigid bodies. If you could think of a better way to do this that would rock.

kbrown 25-03-2007 01:47 AM

You can't use instances if you intend to turn them all to separate rigid bodies afterwards so you'd have to duplicate instead. Nevertheless it sounds like you're trying to do something overly heavy with rigid bodies. I would probably create few rigid body hero bits manually and think of using the particle geometry instancer for the rest. Then again I still don't know what your scene is all about ;)

I have actually done something like this before. I had a particle flow system which was moving soft-body driven geometry (blood cells in a vein). The softies were created and maintained (and removed) on the fly in the particle's creation/runtime expressions. It worked but I remember it being a very "hairy" setup ;)

n8vfx 25-03-2007 04:17 AM

With the help of a friend I created a Particle emitter that emits rigid bodies instead. He used a creation expression to do it. The only draw back is that you can not rewind the geometry and play it again. You have to delete the geometry every time you do a sim. We need to figure out a way to cache the geometry. Any thoughts? Maybe I could use a fluid to control the sim? Paint the velocity on maybe? Just some thoughts


-Nathan


All times are GMT. The time now is 10:12 AM.

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