particle expr. setting position = crash

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  11 November 2012
particle expr. setting position = crash

hello there.
Im kind of new to particle expressions. Im emitting particles from a poly object and also using the same object as goal. now. Ive also created goal weight, position and normal PP attributes. What I want to do in the end is have the particles follow their goal basically, but also tear off and fall at certain velocities. and some other behavior that I want to control with script. and I think I got that bit down, in terms of logic. its just that everytime I try to set the particle position to a value (goalWorldPosition0PP is what I want to begin with but Ive also tried other vectors) in an "after dynamics" expression it does work (ie the particles stay at their goals instead of falling from gravity) , but if I save the file and open it again it either crashes or all the viewports are blank when it opens. (and I have to restart maya to fix this even for other files) am I not supposed to use this attribute or what gives? it seems like such a basic thing... Ive tried using the velocity instead of the position directly; something like:

vector $dir = nParticleShape1.goalWorldPosition0PP - nParticleShape1.position;
nParticleShape1.velocity = $dir * mag($dir) ;

and it works...sometimes? but even at best it needs a long runup to find the goals.

Ive tried turning off and on the collision calculations if thatd be the issue. and its the same if I put it in "before". I dont get it. is there some rule against setting the position directly? or doing that in correlation with some specific setting?
I think there was an example doing that in the docs...?

Another thing is Im setting goalWeight0PP to 0 before dynamics. sometimes it seems like the only way to have maya get the goal info (otherwise the goalWorldPosition is 0,0,0?) without actually using it automatically? but not always. it seems randomly the goalWorldPosition and normal are correct even without it. ...is this right? I mean I know it cant actually be random. but. and it seems that setting this also causes a crash sometimes regardless of the position thing. related?

As you can tell Im pretty confused and dont know what Im doing. Any pointers or advice at all would be great. Ive already wasted days not getting past this.

Im on maya 2011.
__________________
__________________________________________________ _______________
"inbreeding was common in sweden until the bicycle came." - my dad
 
  11 November 2012
I think what you want to be doing not setting the position directly. You should enable 'need parent uv' on the particle emitter, then add the parentU and parentV attributes on the particle shape. Then in the expression editor, set goalU = parentU; and goalV = parentV; this should make the particle stick to the surface of the emitting mesh where they were born. Setting goalweightPP to 0 will disable the goal and the particles will then be affected by dynamics and collisions as normal.
__________________
www.danielelliott.co.uk
 
  11 November 2012
thanks!

thanks for the reply Dan!

yeah I have parent UV enabled and goalU and V set to that. thing is I wanted to control more precisely how they follow the goal (for instance introduce some delay and stuff, but not with that springy behavior of lowering the goal weight...only I didnt get so far playing around with different methods because of the crashes), and also be able to tear the particles off and keep the velocity and angular velocity at that point.
but thats good to know. so I shouldnt have been setting the position but rather switched the goal weight when I wanted to cut them loose. got you!
I guess maybe some combination of setting position and using goals could have been the whole issue? you ARE supposed to be able to set it usually right?
thanks!
__________________
__________________________________________________ _______________
"inbreeding was common in sweden until the bicycle came." - my dad
 
  11 November 2012
Ok well I see what you want now. You need to be using goalOffsetPP. if set goalOffset to -1*velocity then the particles will be offset from their position in the opposite direction to where they are traveling. You don't need to multiply by the mag as the velocity itself isn't normalised. You can multiply it by a constant though if you want to make ita lager or smaller distance.
__________________
www.danielelliott.co.uk
 
  11 November 2012
thanks a lot! Ill give that a go. So youre saying basically that when using goals you shouldnt be fiddling around with the usual stuff at all? =best practice? what if I want to have some of the particles fall off after a while and bounce about?
__________________
__________________________________________________ _______________
"inbreeding was common in sweden until the bicycle came." - my dad
 
  11 November 2012
When using goals, it is the goal that sets the particle position so no you shouldn't touch position in that case.

if you want some particles to drop off then you can set the goalPP to 0. to do it to a percentage of particles, you could use modulus in conjunction with 'id' to select every 2nd, 3rd or nth particle and have them become dynamic again.
__________________
www.danielelliott.co.uk
 
  11 November 2012
ok cheers mate! thanks for all the help!
__________________
__________________________________________________ _______________
"inbreeding was common in sweden until the bicycle came." - my dad
 
  11 November 2012
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



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
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

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


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.