SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / Scirpt help Please
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 22-03-2007, 02:59 PM   #1
n8vfx
Registered User
 
Join Date: Jan 2007
Location: Tulsa
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
n8vfx is offline   Reply With Quote
Old 22-03-2007, 05:13 PM   #2
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

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?
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 22-03-2007, 06:00 PM   #3
Xander-0
Registered User
 
Xander-0's Avatar
 
Join Date: Feb 2005
Location: This Place
Posts: 220
Thanks: 0
Thanked 2 Times in 1 Post
Default

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.
__________________
Book Wise

http://X4nd5r.deviantart.com
Xander-0 is offline   Reply With Quote
Old 23-03-2007, 04:51 AM   #4
n8vfx
Registered User
 
Join Date: Jan 2007
Location: Tulsa
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
n8vfx is offline   Reply With Quote
Old 25-03-2007, 01:47 AM   #5
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

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
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 25-03-2007, 04:17 AM   #6
n8vfx
Registered User
 
Join Date: Jan 2007
Location: Tulsa
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
n8vfx is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.