appendix

 
 script bbClampSpeed

Synopsis
int bbClampSpeed(string $particleNode)

ReturnValue
1 if operation successfuly, 0 else

Description
This command makes modifications to a particle node, so that particle velocity can be min / max clamped.

Modifications in detail: Attributes Minimum Speed and Maximum Speed are added:

addAttr -sn mis -ln bbMinimumSpeed -dv 0.0 -min 0.0 -max 100;
addAttr -sn ms -ln bbMaximumSpeed -dv 5.0 -min 0.001 -max 100;

Runtime expression is added to velocity in Per Particle (Array) Attributes - it clamps the length of the velocity vector while maintaining its orientation.

$minS = particle.bbMinimumSpeed;
$maxS = particle.bbMaximumSpeed;
$vel  = particle.velocity;

$velLength = mag($vel);

if ($velLength > $maxS)
{
   $vel *= $maxS / $velLength ;
}
else
{
   if (($velLength < $minS)&&($velLength >0))
   {
      $vel *= $minS /$velLength ;
   }
}

particle.velocity = $vel;

Finally Expression after Dynamics is set to true, so the expression will have the desired effect.

Arguments
string $particleNode - particle node wich is to be modified

Examples

Create particle node particleShape1, then enter :

bbClampSpeed particleShape1;

Notes
-/-