# SimplyMaya Forums

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

 SM Forums / Maya Questions / Dynamics & Special Effects / EXPRESSIONS FOR ALL! (knowledge tidbits)
 Register FAQ Calendar Mark Forums Read

 Dynamics & Special Effects Maya Particles, nDynamics, Fluids, Rigid Bodies & General VFX

 Page 5 of 5 « First < 3 4 5
 25-10-2016, 07:44 PM #61 Animate95 Registered User   Join Date: Oct 2016 Posts: 1 Help with a noise expression Hi! I saw that everyone has been posting mel solutions for various expressions. I was wondering if anyone knew how to create an expression for making particles move randomly. I am in the process of creating particle effects for pollen, but I can't get the particles to move independently around the object. I looked into different expressions that could possibly work, but not one has been successful. I believe that this has to be done from the per particle array under a noise expression. If anyone could help it would be much appreciated!
04-02-2017, 03:26 PM   #62
simplymaaya
Registered User

Join Date: Feb 2017
Posts: 1
Quote:
 This expression will take the attribute of an object at a certain “offset” time, and apply it to another objects attribute. For instance it will take it off a cubes translateZ attribute, and assign it to a spheres translateZ attribute. -Create a new scene. -Create a polyCube. -Create a polySphere. -Translate the sphere about 10 units in Y. -Open the Expressions editor, then Select Filter/By Expression Name. -Type in the following: int \$offset = 10; int \$currentTime = `currentTime -q`; \$offsetTime = \$currentTime - \$offset; \$cube1Zpos = `getAttr -t \$offsetTime pCube1.tz`; pSphere1.translateZ = \$cube1Zpos; -Hit Create. and here is the explaination ! //Time offset expression //offset length (in frames) int \$offset = 10; //Get current time int \$currentTime = `currentTime -q`; //Substract the offset to the current time //so if current time is 10, //and offset is 2, offsetTime will be 8 \$offsetTime = \$currentTime - \$offset; //Get the value of pCube1.translateZ //at frame \$offsetTime (8 in our example) \$cube1Zpos = `getAttr -t \$offsetTime pCube1.tz`; //Assign it to pSphere1.translateZ pSphere1.translateZ = \$cube1Zpos; This could be taken much further, you could for example setup joints and IK so it looks like power tubes are going from the mothership to the children, you could also add a custom attribute called “motion” and multiply the “noise” section of the expression by it, so that if you decide to turn you noisy motion off you would just have to set the custom attribute to 0. You could keyframe that attribute so you could control the random “floating” motion of the ship throughout the scene so it stops looking as if it were floating if it lands for example. This type of setup could also be applied to a cranefly, or any other type of futuristic flying object etc. Experiment with setting all sorts of different relationships etc until you are comfortable with this expression. this is very handy little snippet from Oliver Shyal Beardsley thanks alot for .......it hope you enjoy it........... Originally Posted by mind_raper View original post

http://shyal.com and Shyal Beardsley's showreel https://www.youtube.com/watch?v=V9HTrE7xEnc

 20-04-2020, 03:44 AM #63 HcRev Registered User   Join Date: Dec 2012 Posts: 8 Driving per particle position with mash points Looking for a way for nparticles to be driven by a MASH network. Specifically so that the looping signal node animation can be applied to the particles. Ideally, in the case of having 20 points, each MASH point would drive one of the 20 nParticles positions. Attempted to write a runtime expression: Code: `nParticleShape1.position = MASH.positions` But although it does set the position correctly on the current frame once created, it fails to evaluate on every other frame during playback. Attempted connecting the two attributes using python: Code: `cmds.connectAttr( 'MASH.positions', 'nParticleMashShape.position')` But I get a runtime error: The attribute 'MASH.positions' cannot be connected to 'nParticleMashShape.position'. And a warning: Connection from MASH.positions ---> nParticleMashShape.position was not allowed. You can only connect to a per-particle attribute from another per-particle attribute on the same shape or from an arrayMapper or particleAgeMapper node. This may cause subsequent connections to fail during duplication with the "-ic" flag. If this is just not possible, what would be a decent approach to have the nParticles animated positions loop seamlessly?
 26-04-2020, 06:19 PM #64 HcRev Registered User   Join Date: Dec 2012 Posts: 8 This solved it : https://gfxhacks.com/driving-npartic...aya-with-mash/
 Page 5 of 5 « First < 3 4 5