Precipitation - LuisAntonRebollo/Torque-3D-Wiki-Test GitHub Wiki

<SCRIPT SRC="../../../include/tutorial.js" LANGUAGE="JavaScript"></SCRIPT> <SCRIPT SRC="../../../include/prototype.js" LANGUAGE="JavaScript"></SCRIPT> <SCRIPT SRC="../../../include/scriptaculous.js" LANGUAGE="JavaScript"></SCRIPT> <SCRIPT SRC="../../../include/glossaryLookUp.js" LANGUAGE="JavaScript"></SCRIPT> <SCRIPT SRC="../../../include/referenceLookUp.js" LANGUAGE="JavaScript"></SCRIPT> <SCRIPT SRC="../../../include/component.js" LANGUAGE="JavaScript"></SCRIPT> <SCRIPT SRC="../../../include/componentContainer.js" LANGUAGE="JavaScript"></SCRIPT> <SCRIPT>DocImagePath = "../../../";</SCRIPT> <script> // this script chunk is to update the ToC to the current doc and expand it pageID = 86; parent.leftFrame.expandToItem('tree2', 'doc86'); var element = parent.leftFrame.document.getElementById('doc86'); if((element) && (element.className==parent.leftFrame.nodeClosedClass)) { element.className = parent.leftFrame.nodeOpenClass } ; </script> <title>Torque 3D - Precipitation</title> <script type="text/javascript" src="../../../include/wz_tooltip.js"></script>
    <table border="0" cellpadding="0" cellspacing="0" width="700">
      <tbody>
        <tr>
          <td width="700"><table id="toc" summary="Contents">
              <tbody>
                <tr>
                  <td><div id="toctitle">
                      <h2>Contents</h2></div>
                    <ul>
                      <li class="toclevel-1"><a href="#Introduction"><span class="tocnumber">1</span> <span class="toctext">Introduction</span></a></li>
                      <li class="toclevel-1"><a href="#Adding_Precipitation"><span class="tocnumber">2</span> <span class="toctext">Adding Precipitation</span></a></li>
                      <li class="toclevel-1"><a href="#Precipitation_Properties"><span class="tocnumber">3</span> <span class="toctext">Precipitation Properties</span></a></li>
                      <li class="toclevel-1"><a href="#PrecipitationData_Properties"><span class="tocnumber">4</span> <span class="toctext">PrecipitationData Properties</span></a></li>
                      <li class="toclevel-1"><a href="#Conclusion"><span class="tocnumber">5</span> <span class="toctext">Conclusion</span></a></li>
                    </ul></td>
                </tr>
              </tbody>
            </table>
            <a name="Introduction" id="Introduction"></a>
            <h2> <span class="mw-headline">Introduction</span></h2>
            <p>The Torque 3D World Editor allows you to quickly add different types
              of precipitation to your level. However, Precipitation is used as a general term meaning any type of particle moving downward. The ability to quickly add rain, snow, or even a sandstorm to your
              level is built into the editor. <br />
              <a name="Adding_Precipitation" id="Adding_Precipitation"></a>                </p>
            <h2> <span class="mw-headline">Adding Precipitation</span></h2>
            <p>To add Precipitation to a level, switch to the Library tab in the Scene Tree panel. Click on the Level tab amd double-click the Environment folder. Locate the Precipitation entry. </p>
            <p><br />
              <img alt="Image:PrecipLibrary.jpg" src="images/PrecipLibrary.jpg" border="0" height="322" width="209" /> </p>
            <p><br />
            Double-click the Precipitation entry.The Create Object dialog will appear.</p>
            <p><br />
              <img alt="Image:NamePrecipRain.jpg" src="images/NamePrecipRain.jpg" border="0" height="115" width="256" /> </p>
            <p><br />
            Enter a name for your Precipitation object. The Precipitation data field allows you to choose a datablock to start with as the basis for your new object. Click the drop down box for a list of available datablocks. </p>
            <p><br />
              <img alt="Image:UseHeavyRainDB.jpg" src="images/UseHeavyRainDB.jpg" border="0" height="115" width="257" /> </p>
            <p><br />For the Full template, your only choice is <em>HeavyRain</em> so select it then click Create New. Your new Precipitation object will be added to your level, and rain will start falling automatically. The stock datablock for HeavyRain simulates a light shower, so you may not see much rain falling: </p>
            <p><br />
              <i>(click to enlarge)</i> </p>
            <a href="images/PrecipAdded.jpg" class="livethumbnail"><img src="images/PrecipAdded.jpg" width="320" height="247" largewidth="640" largeheight="495" /></a><br />
            <p><br />
              The <i>HeavyRain</i> datablock is located in the <b>game/art/datablocks/environment.cs</b> file. Its initial data contains the following: </p>
            <pre>datablock PrecipitationData(HeavyRain)

{ soundProfile = "HeavyRainSound";

dropTexture = "art/environment/precipitation/rain"; splashTexture = "art/environment/precipitation/water_splash"; dropSize = 0.35; splashSize = 0.1; useTrueBillboards = false; splashMS = 500; };


We will get into manipulating the datablock later.


Precipitation Properties


Additional properties can be changed with the Inspector pane. To change a Precipitation objects properties using the Inspector Pane click the Scene tab, then click the name of your new Precipitation object. The Inspector pane will update to display the current properties of your new sun.

Hover over each section in the image below to see a description of the fields within it:














PrecipitationData Properties

When you add a Precipitation object to a level from the Library, you are adding the actual precipitation object. In order for the object to work however it must be assigned a datablock. Datablocks have their own set of properties which are transmitted over a server to each client. When creating or editing a PrecipitationData datablock, you will be modifying the following properties:


(hover over image for descriptions






Conclusion

Of all the objects you can add to a level, Precipitation has the widest range of applications. Remember, this object is not limited to rain. Anything that can fall from the sky or float in the air over large areas can be simulated with Precipitation: snow, sandstorms, falling ash and rock, fireflies, and so on. Take the time to experiment with this to see what you can come up with.

Home Back to Top
<script type="text/javascript">

var links = document.getElementsByTagName('a');

for (var i = 0; i < links.length; i++) if (links[i].className == 'livethumbnail') { var img = links[i].getElementsByTagName('img')[0]; img.state = 'small'; img.smallSrc = img.getAttribute('src'); img.smallWidth = parseInt(img.getAttribute('width')); img.smallHeight = parseInt(img.getAttribute('height')); img.largeSrc = links[i].getAttribute('href'); img.largeWidth = parseInt(img.getAttribute('largewidth')); img.largeHeight = parseInt(img.getAttribute('largeheight')); img.ratio = img.smallHeight / img.smallWidth; links[i].onclick = scale; }

function scale() { var img = this.getElementsByTagName('img')[0]; img.src = img.smallSrc;

if (! img.preloaded)
{
	img.preloaded = new Image();
	img.preloaded.src = img.largeSrc;
}

var interval = window.setInterval(scaleStep, 10);
return false;

function scaleStep()
{
	var step = 45;
	var width = parseInt(img.getAttribute('width'));
	var height = parseInt(img.getAttribute('height'));
	
	if (img.state == 'small')
	{
		width += step;
		height += Math.floor(step * img.ratio);
		
		img.setAttribute('width', width);
		img.setAttribute('height', height);
		
		if (width > img.largeWidth - step)
		{
			img.setAttribute('width', img.largeWidth);
			img.setAttribute('height', img.largeHeight);
			img.setAttribute('src', img.largeSrc);
			window.clearInterval(interval);
			img.state = 'large';
		}
	}
	else
	{
		width -= step;
		height -= Math.floor(step * img.ratio);

		img.setAttribute('width', width);
		img.setAttribute('height', height);
		
		if (width < img.smallWidth + step)
		{
			img.setAttribute('width', img.smallWidth);
			img.setAttribute('height', img.smallHeight);
			img.src = img.smallSrc;
			window.clearInterval(interval);
			img.state = 'small';
		}
	}
}			

}

</script>
⚠️ **GitHub.com Fallback** ⚠️