Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 22-03-2007, 03: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, 06: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, 07: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, 05:51 AM   #4
n8vfx
Registered User
 
Join Date: Jan 2007
Location: Tulsa
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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, 02: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, 05: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

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.