BrainBugz / docs / bb_clamp.htm

<title>brainbugz Documentation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0">
    <td bgcolor="#003366"><font face="Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><a name="deta"></a>&nbsp;appendix</font></td>

<table width="95%" border="0">
      <td bgcolor="#005BB7"><font face="Arial, Helvetica, sans-serif" size="3" color="#FFFFFF"><b><a name="de_cla"></a>&nbsp;script 
  <font face="Courier New, Courier, mono" size="2">int bbClampSpeed(string $particleNode) 
  1 if operation successfuly, 0 else</p>
  This command makes modifications to a particle node, so that particle velocity 
  can be min / max clamped. <br>
  Modifications in detail: Attributes Minimum Speed and Maximum Speed are added:</p>

  <table width="503" border="0">
      <td bgcolor="#FFFFCC"> 
        <p><font face="Courier New, Courier, mono" size="2">addAttr -sn mis -ln 
          bbMinimumSpeed -dv 0.0 -min 0.0 -max 100;<br>
          addAttr -sn ms -ln bbMaximumSpeed -dv 5.0 -min 0.001 -max 100;</font></p>
<p>Runtime expression is added to <b>velocity</b> in <b>Per Particle (Array) Attributes</b> 
  - it clamps the length of the velocity vector while maintaining its orientation.<br>
<table width="368" border="0">
      <td bgcolor="#FFFFCC"> 
        <p><font face="Courier New, Courier, mono" size="2">$minS = particle.bbMinimumSpeed;<br>
          $maxS = particle.bbMaximumSpeed;<br>
          $vel &nbsp;= particle.velocity;<br>
          </font><font face="Courier New, Courier, mono" size="2"><br>
          $velLength = mag($vel);</font></p>
        <p><font face="Courier New, Courier, mono" size="2">if ($velLength &gt; 
          &nbsp;&nbsp;&nbsp;$vel *= $maxS / $velLength ;<br>
          &nbsp;&nbsp;&nbsp;if (($velLength &lt; $minS)&amp;&amp;($velLength &gt;0))<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$vel *= $minS /$velLength ;<br>
        <p><font face="Courier New, Courier, mono" size="2">particle.velocity 
          = $vel;</font></p>

<p>Finally <b>Expression after Dynamics</b> is set to true, so the expression 
  will have the desired effect.</p>
  <font face="Courier New, Courier, mono" size="2">string $particleNode</font> 
  - particle node wich is to be modified</p>
<p>Create particle node <font face="Courier New, Courier, mono" size="2">particleShape1</font>, 
  then enter :</p>
<p><font face="Courier New, Courier, mono" size="2">bbClampSpeed particleShape1;<br>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.