Beer glass scene creation
This course contains a little bit of everything with modeling, UVing, texturing and dynamics in Maya, as well as compositing multilayered EXR's in Photoshop.
# 61 25-10-2016 , 07:44 PM
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!

# 62 04-02-2017 , 03:26 PM
Registered User
Join Date: Feb 2017
Posts: 1

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`;
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`;

//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

hope you enjoy it........... and Shyal Beardsley's showreel

# 63 20-04-2020 , 03:44 AM
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:

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:

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?

# 64 26-04-2020 , 06:19 PM
Registered User
Join Date: Dec 2012
Posts: 8
# 65 03-08-2021 , 09:29 PM
Registered User
Join Date: Aug 2021
Posts: 1

HELP Maya, expression editor

I have zero Knowledge about coding. Its hard.
I need a favor, please.
Im creating a simultaion in maya bifrost and I need the Emitter to stop *continous emission* (attribute in emitterprops) at a frame point of 26.
The attribute is just a checkbox. how do i create an expression for this? Because keyframing doesn't help?
please help me solve this issue.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads