Go to: Return value. Related commands. Flags. Examples.
-o/object ParticleName
-pos/position xPosition yPosition zPosition
-at/attribute AttributeName
-vv/vectorValue xValue yValue zValue
-fv value
attribute, floatValue, object, position, vectorValue
![]() | ![]() |
![]() | ![]() |
particle; emit -object particle1 -position 1 1 1; // This will create one particle at position <<1,1,1>> in the // already-existing particle object <i>particle1</i>. // particle; emit -object particle1 -position 1 1 1 -position 2 2 2 -attribute velocity -vectorValue 1 2 3 -vectorValue 2 3 4 -attribute rgbPP -vectorValue .5 1 0 -floatValue .1; // This will create two particles at positions <<1,1,1>> and <<2,2,2>> in // the already-existing particle object <i>particle1</i>. Then the velocity // attribute of those particles is set to <<1,2,3>> and <<2,3,4>>, // respectively. Also, the rgbPP values are set to <<.5,1,0>> and // <<.1,.1,.1>>, respectively. Notice that the rgbPP value for the // second particle was set with the -floatValue flag, even though rgbPP // is a vector attribute. The single value was converted into a vector. particle; emit -object particle1 -position 1 1 1 -position 2 2 2 -position 3 3 3 -position 4 4 4 -position 5 5 5 -attribute velocity -vectorValue 1 2 3 -vectorValue 2 3 4 -attribute mass -floatValue .5 -vectorValue .1 .2 .3 -attribute velocity -vectorValue 3 4 5; // This will create five particles in <i>particle1</i>. The values // for their attributes are: // // Attribute Particle1 Particle2 Particle3 Particle4 Particle5 // ----------+-----------+-----------+-----------+-----------+--------- // position <<<<1,1,1>>>> <<<<2,2,2>>>> <<<<3,3,3>>>> <<<<4,4,4>>>> <<<<5,5,5>>>> // velocity <<<<1,2,3>>>> <<<<2,3,4>>>> <<<<3,4,5>>>> <b><<<<3,4,5>>>> <<<<3,4,5>>>></b> // mass .5 .3742 <b>.3742 .3742 .3742</b> // // Notice that the second value for mass was seet with the -vectorValue // flag, even though mass is a float attribute. The vector was // converted into a float by taking its length. Also, notice the <b>bold</b> // values in the table. The values for those attribute values were not // explicitly set in the command. If there are fewer values given for // an attribute than there are position flags, the remaining unset // values are set to the last value set for that attribute. This // allows the user to set many of the values to be the same without // having to use multiple value flags. One last note. Notice that the // attribute flag was passed twice for the attribute velocity. The value // flags for repeated attributes pick up where the previous ones left // off. float $x = rand(1); float $y = rand(1); float $z = rand(1); vector $p = sphrand(5); emit -object particle1 -pos $x $y $z -pos ($p.x) ($p.y) ($p.z); // This is a piece of MEL code that could be put in a script or // even in an expression. It adds two new particles to the // already-existing particle object <i>particle1</i>. It adds them // at random positions, however. These random values can be computed // and stored in MEL variables. Then those variables can be used in // the emit action. Notice that the float variables can be used // directly, but the components of the vector must be enclosed in // parentheses. This is also true if they are used to with the // <b>-vectorValue</b> flag. int $i; int $emitCount = rand(10,15); string $objectName = "object1"; string $emitCmd = ("emit -object " + $objectName + "\n"); for( $i = 0; $i < $emitCount; $i ++ ) { vector $pos = sphrand(10); $emitCmd += " -pos "+$pos+"\n"; } $emitCmd += " -at velocity\n"; for( $i = 0; $i < $emitCount; $i ++ ) { vector $vel = sphrand(5); $emitCmd += " -vv "+$vel+"\n"; } eval( $emitCmd ); // This is a piece of MEL code that could be put in a script or // even in an expression. It adds a random number of particles // to the already-existing particle object <i>particle1</i>. Since // the number of particles as well as the positions and velocities // of the particles are random, it would be impossible to just have // the emit action itself in the expression or script. It must be // built as a string and then sent to the command processor with the // <b>eval</b> or <b>evalEcho</b> commands. Notice that when appending // the vector variables to the string, it is not necessary to append // each component of the vectors separately. When they are converted // from a vector to a string, the three components get separated with // a space automatically, thus formatting them in the desired way. // An example of a possible result from this "script" could be: emit -object particle1 -pos 1.899864198 -6.721569708 0.585203937 -pos 8.103957656 -4.042442985 2.047724209 -pos -1.392914569 -0.109724376 8.62265813 -pos 1.960103537 -3.203145195 -7.6892516 -pos 2.564072614 -6.049536895 1.334818295 -pos -5.603376821 4.33595058 6.952385447 -pos -2.478591746 6.286855715 6.851659059 -pos 2.424670276 -4.083412217 6.320538621 -pos 6.440800453 3.405519296 5.462135819 -pos 2.445192551 1.397203422 3.443755853 -at velocity -vv -2.348796409 4.022130218 0.5316172944 -vv 4.149667117 -1.023146404 1.97965556 -vv -0.08429132578 -0.5518495233 1.591812495 -vv 2.597930963 1.033536331 -1.398351383 -vv -3.102859272 3.423569856 0.7895603241 -vv -2.519331228 -2.5684916 -1.530779154 -vv -2.645169119 -0.3186551381 0.9164776099 -vv -0.6183816487 -1.060784068 -0.8748223942 -vv -0.2460372256 3.567980747 -2.007567372 -vv 1.735044809 -3.660099445 -1.765401859; // The spacing in the string is just for formatting reasons and does // not affect how the action executes or compiles.