<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Everyday 3D &#187; as3dmod</title>
	<atom:link href="http://www.everyday3d.com/blog/index.php/category/as3dmod/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.everyday3d.com/blog</link>
	<description>3D user experience on the web. Design, technology news. A blog by Bartek Drozdz.</description>
	<lastBuildDate>Fri, 03 Sep 2010 15:27:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Modifiers in Unity3D</title>
		<link>http://www.everyday3d.com/blog/index.php/2009/11/10/porting-actionscript-to-unity3d/</link>
		<comments>http://www.everyday3d.com/blog/index.php/2009/11/10/porting-actionscript-to-unity3d/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 13:04:03 +0000</pubDate>
		<dc:creator>bartek drozdz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Unity3d]]></category>
		<category><![CDATA[as3dmod]]></category>

		<guid isPermaLink="false">http://www.everydayflash.com/blog/?p=438</guid>
		<description><![CDATA[Ringo from FlashBookmarks asked me if there were modifiers similar to AS3Dmod in Unity. I searched for something similar some time ago, but didn't find anything interesting. However, when I was starting C# scripting, I ported two of the modifiers from AS3Dmod - Bend and Twist. So I thought to share them with everyone. Don't [...]]]></description>
			<content:encoded><![CDATA[<p><img width="520" height="279" src="http://www.everydayflash.com/blog-assets/unityModifier.jpg"/></p>
<p>Ringo from <a href="http://www.flashbookmarks.com/">FlashBookmarks</a> asked me if there were modifiers similar to <strong>AS3Dmod</strong> in <a href="http://unity3d.com/">Unity</a>. I searched for something similar some time ago, but didn't find anything interesting. </p>
<p>However, when I was starting C# scripting, I ported two of the modifiers from AS3Dmod - <strong>Bend and Twist</strong>. So I thought to share them with everyone. Don't expect much, it's not the full library, just two classes. If I have some free time, I'll look into how to implement stacking, since for the moment you cannot apply two modifiers to the same object (the second one won't have any effect). </p>
<p>To play around with them grab <a href="http://www.everydayflash.com/unity3d/UnityModifiers.unitypackage">this package</a> and import it into Unity. Keep in mind that the modifiers work at runtime, so you won't see any effects in the editor until you run the game. If you want to animate them, just add another script that will have a reference to the modifier instance and change it's properties at each Update() call.</p>
<p>If you are interested in this kind of "bricolage" with 3D geometry, I recommend to take a look at the <strong><a href="http://unity3d.com/support/resources/example-projects/procedural-examples">Procedural Examples</a></strong> project provided by Unity. You will find there some highly interesting samples like <strong>dynamic extrudes or perlin noise</strong>. It's a great starting point to explore <strong>runtime geometry transformation</strong>. </p>
<p>Of course, take a look into the sources of the modifiers too! You'll see how simple it is to access the geometry at runtime and do some modifications. Basically it goes like this: </p>
<div class="igBar"><span id="lcsharp-2"><a href="#" onclick="javascript:showPlainTxt('csharp-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-2">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MeshFilter mfilter&nbsp; = GetComponent<span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span style="color: #008000;">typeof</span></a><span style="color: #000000;">&#40;</span>MeshFilter<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">as</span> MeshFilter;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mesh = mfilter.<span style="color: #0000FF;">mesh</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Vector3<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> vs = mesh.<span style="color: #0000FF;">vertices</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF0000;">int</span> vc = vs.<span style="color: #0000FF;">Length</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i = <span style="color: #FF0000;color:#800000;">0</span>; i &lt;vc; i++<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #008080; font-style: italic;">// Modify your vertices here</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mesh.<span style="color: #0000FF;">vertices</span> = vs;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mesh.<span style="color: #0000FF;">RecalculateNormals</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Things worth notice: In Unity a <strong>vertex is just an instance of Vector3</strong> - there isn't any special class for this, as in Flash-based 3D engines. </p>
<p>You can see a bit of the casting-drama I need to do (lines 1-2) to get to the object holding the actual geometry information (Mesh). That's a bit annoying in C#, with JS that code would be more readable. Anyway, it's better to <strong>make that only once</strong>, in Start() and not at every Update(). </p>
<p>To get <strong>correct lightning effects</strong> on the materials, do not forget to call <strong>mesh.RecalculateNormals()</strong> after you've modified the positions of the vertices.</p>
<p>If you want to modify your mesh continuously (i.e. to animate it) it's necessary to keep the <strong>original array of vertices</strong>, because the code above overwrites the original positions. Take a look at the <a href="http://www.everydayflash.com/unity3d/UnityModifiers.unitypackage">source code in the package</a> to see how I did it. </p>
<p>That's all for now, hope you enjoy it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.everyday3d.com/blog/index.php/2009/11/10/porting-actionscript-to-unity3d/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PDFBook3D, a 3D flipbook engine</title>
		<link>http://www.everyday3d.com/blog/index.php/2009/04/03/pdfbook3d-3d-flipbook-engine/</link>
		<comments>http://www.everyday3d.com/blog/index.php/2009/04/03/pdfbook3d-3d-flipbook-engine/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 11:16:37 +0000</pubDate>
		<dc:creator>bartek drozdz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[News & Events]]></category>
		<category><![CDATA[as3dmod]]></category>
		<category><![CDATA[away3d]]></category>
		<category><![CDATA[flipbook]]></category>
		<category><![CDATA[flippage]]></category>
		<category><![CDATA[pdfbook]]></category>
		<category><![CDATA[powerflasher]]></category>

		<guid isPermaLink="false">http://www.everydayflash.com/blog/?p=118</guid>
		<description><![CDATA[PDFBook3D is a Flash application that allows to transform a PDF document into a 3D model, that later can be viewed pretty much like a real book. The product was just released by Powerflasher, and I was involved in creating the front-end 3d Flash part of it. This application belongs to the family of flipbook [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.powerflasher.de/pdfbook3d/" target="_blank"><img src="/flash/pdfbook/pdfbook3d.jpg" width="520" height="190" border="0" alt="PDFBook3d"></a></p>
<p><strong><a href="http://www.powerflasher.de/pdfbook3d/" target="_blank">PDFBook3D</a></strong> is a Flash application that allows to transform a <strong>PDF document into a 3D model</strong>, that later can be viewed pretty much like a real book. The product was just released by <a href="http://solutions.powerflasher.com/en/products/pdfbook-3d/information/" target="_blank">Powerflasher</a>, and I was involved in creating the front-end 3d Flash part of it. </p>
<p>This application belongs to the family of flipbook engines. I am sure you have seen the classic 2D version of a flipbook at least once. It is widely popular around the web! <strong>PDFBook3D</strong> replaces this classic piece with a more accurate and realistic 3D version of the effect created with <strong>AS3Dmod bend modifier</strong>. The bend modifier allows to create paper simulation in Flash, which is something I already posted about <a href="http://www.everydayflash.com/blog/index.php/2008/11/03/paper-simulation-as3dmod/">back in November</a>.</p>
<p>The application has a rich set of configurable properties, including dimensions of the book (for non typical page sizes) and a number of quality settings to get a decent framerate on slower machines as well. The Powerflasher team created an admin interface to generate 3d books on the fly. You can see it in action <a href="http://pdfbook-3d-demo.powerflasher.com/" target="_blank">here</a>. The product functionality also includes links editor and video embedding. If you are interested in more information please refer to the <a href="http://solutions.powerflasher.com/en/products/pdfbook-3d/information/" target="_blank">Powerflasher Solutions</a> site. </p>
<p>PDFBook3D is also my first commercial project made using <strong><a href="http://www.away3d.com" target="_blank">Away3D</a></strong>. There are a few features in Away3D that made me choose it, but mostly it was the curiosity to try <em>"the other"</em> engine. I must admit Away3D turned out to be pretty cool! </p>
<p>It is most famous for its advanced features like <a href="http://www.closier.nl/blog/?p=82" target="_blank">normal maps</a>, <a href="http://www.closier.nl/blog/?p=73" target="_blank">path extrudes</a> and <a href="http://www.infiniteturtles.co.uk/blog/away3d-multimario" target="_blank">bones animation</a>. However, this project does not rely on those advanced functionalities. Most of what I used in here is pretty basic, but still I was able to find some cool stuff. </p>
<p>One very useful feature is being able to assign <strong>back material</strong> to planes. It might not seem like a huge thing, but since it is used to create the flipping page, it helped me a lot. Actually any <strong>mesh in Away3D can have a back material</strong> assigned to its faces using the <code>back</code> property of the class:</p>
<div class="igBar"><span id="lactionscript-4"><a href="#" onclick="javascript:showPlainTxt('actionscript-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-4">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">myMesh.<span style="color: #006600;">material</span> = <span style="color: #000000; font-weight: bold;">new</span> WireframeMaterial<span style="color: #66cc66;">&#40;</span>0xff0000<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// classic front-side material</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">myMesh.<span style="color: #006600;">back</span> = <span style="color: #000000; font-weight: bold;">new</span> WireframeMaterial<span style="color: #66cc66;">&#40;</span>0x00ff00<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// back material </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice, that it is not the same thing as having a <strong>double sided material</strong> - that is, the same material used for both sides of a face. In this case - one material is used for one side, and a completely different one for the other. This is why it was perfect for creating a page of a book.</p>
<p>Another cool feature of Away3D is <strong>triangle caching</strong> - it is a built in functionality, that doesn't require any extra coding and it can give a significant <a href="http://www.infiniteturtles.co.uk/blog/awa3d-220-sierpinski-turtles" target="_blank">performance boost</a>. Thanks to triangle caching, whenever the page flip animation is on, the rest of the book that does not move at this moment is not re-rendered at each frame. A similar optimization can be achieved in Papervision3D using render layers, but it's not as easy to use. </p>
<p>Last but not least, I'd like to thank <a href="http://blog.closier.nl/" target="_blank">Fabrice Closier</a> from the Away3D team for support and feedback during the project! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.everyday3d.com/blog/index.php/2009/04/03/pdfbook3d-3d-flipbook-engine/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>3D experiments with Flash Player 10 and AS3Dmod</title>
		<link>http://www.everyday3d.com/blog/index.php/2009/03/16/3d-experiments-with-flash-player-10-and-as3dmod/</link>
		<comments>http://www.everyday3d.com/blog/index.php/2009/03/16/3d-experiments-with-flash-player-10-and-as3dmod/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 10:50:32 +0000</pubDate>
		<dc:creator>bartek drozdz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[as3dmod]]></category>
		<category><![CDATA[flash player 10]]></category>
		<category><![CDATA[3d animation]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[away3d]]></category>
		<category><![CDATA[fp10]]></category>
		<category><![CDATA[papervision3d]]></category>

		<guid isPermaLink="false">http://www.everydayflash.com/blog/?p=54</guid>
		<description><![CDATA[Demos: [ 1 ] [ 2 ] [ 3 ] [ 4 ]&#160;&#160;&#160;&#160;&#160;&#160;Flash Player 10 required (obviously) Flash Player 10 has been around for a few months now. As most of you know, it brings some native 3D support. It's not as robust as Papervision3D or Away3D, and in fact was not designed to compete [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/flash/as3dmod/fp10/as3dmod-fp10.gif" width="520" height="280" border="0" alt="Flash Player 10 3D experiments"></p>
<p><strong>Demos: <a href="http://www.everydayflash.com/flash/as3dmod/fp10/points3d.html" target="_blank">[ 1 ]</a> <a href="http://www.everydayflash.com/flash/as3dmod/fp10/walk.html" target="_blank">[ 2 ]</a> <a href="http://www.everydayflash.com/flash/as3dmod/fp10/tunnel.html" target="_blank">[ 3 ]</a> <a href="http://www.everydayflash.com/flash/as3dmod/fp10/twistedRibbon.html" target="_blank">[ 4 ]</a></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>Flash Player 10 required (obviously)</em></p>
<p><strong>Flash Player 10</strong> has been around for a few months now. As most of you know, it brings some <strong>native 3D support</strong>. It's not as robust as <a href="http://blog.papervision3d.org/" target="_blank">Papervision3D</a> or <a href="http://www.away3d.com/" target="_blank">Away3D</a>, and in fact was not designed to compete with those engines. Rather than that, it contains classes that perform 3D calculations and allows basic 3D manipulation of display objects.</p>
<p>The last months I focused on catching up with <strong>3D math</strong>. I ordered a book called <a href="http://www.amazon.co.uk/Primer-Graphics-Development-Wordware-Library/dp/1556229119/" target="_blank">"3D Math Primer"</a>, which explains in detail all the vector and matrix operations involved in 3D graphics. Even though the examples are in C++ I recommend this book to anyone doing 3D in Flash. The authors made a great effort to explain the subject with clarity. It worked pretty well for me and I understand the math behind 3D much better now. </p>
<p>Both <a href="http://blog.papervision3d.org/" target="_blank">Papervision3D</a> and <a href="http://www.away3d.com/" target="_blank">Away3D</a> were created so that <strong>we don't have to deal directly with 3D calculations</strong>. If you are working on a project that involves non-trivial 3D and has a deadline, it's better to choose one of those engines instead of "pure Flash Player 10". </p>
<p>However, if you just want to do some <strong>casual experiments</strong> and learn something on the way, <strong>FP10 is great</strong>. It offers a small number of tools, focused around <strong>Vector3D and a Matrix3D</strong> classes. These classes offer low level functionality, so to use them one needs to understand what's going on under the hood. This is a great way to learn! </p>
<p>Then I had this idea to port <strong>AS3Dmod to Flash Player 10</strong> and try to run the modifiers on objects created using FP10 3D classes. It turns out it was not so difficult. Instead of rendering textured 3D objects I just render a <strong>single pixel for each vertex</strong>. Thanks to this I get a relatively good performance even with as much as <strong>8000 vertices</strong>. I found that a modifier applied to such a large amount of vertices, gives interesting visual effects. I even wrote a very simple <strong>Wavefront OBJ importer</strong>, and I could import the 3d pants model from one of my <a href="http://www.everydayflash.com/blog/index.php/2009/02/09/making-things-walk-in-flash-3d/" target="_blank">previous posts</a> to <a href="http://www.everydayflash.com/flash/as3dmod/fp10/walk.html" target="_blank">render them in Flash Player 10</a>. </p>
<p>All my previous demos with AS3Dmod involved pretty <strong>small amount of vertices</strong> - most often no more than 500-600. At this level the performance of the modifiers was not a problem. But with 8000 vertices the modifiers start to have an big impact on the frame rate. A Perlin modifier alone takes <strong>4-5 FPS</strong>, which is quite a lot and it got me worried. I believe code optimizations are in order. An interesting solution could be to implement the <strong>modifiers as a Pixel Bender kernels</strong>. Anyway, I need to do some more research...</p>
<p>In the AS3Dmod SVN you'll find the <a href="http://code.google.com/p/as3dmod/source/browse/#svn/branches/fp10" target="_blank">FP10</a> branch. The main difference between this version and the trunk is that it uses FP10 built-in <strong>Vector3D</strong> and <strong>Matrix3D</strong> classes as well as <strong>Vectors instead of Arrays</strong>. The sources for all experiments mentioned above, including a simple AS3Dmod plugin for FP10, are <a href="http://code.google.com/p/barteksplayground/source/browse/#svn/trunk/fp10/src/com/everydayflash/cart" target="_blank">available here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.everyday3d.com/blog/index.php/2009/03/16/3d-experiments-with-flash-player-10-and-as3dmod/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Car simulation with Maya &amp; Papervision3d</title>
		<link>http://www.everyday3d.com/blog/index.php/2009/02/13/car-simulation-with-maya-papervision3d/</link>
		<comments>http://www.everyday3d.com/blog/index.php/2009/02/13/car-simulation-with-maya-papervision3d/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 10:17:09 +0000</pubDate>
		<dc:creator>bartek drozdz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[as3dmod]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[car]]></category>
		<category><![CDATA[car game]]></category>
		<category><![CDATA[car physics]]></category>
		<category><![CDATA[car simulation]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[mustang]]></category>
		<category><![CDATA[papervision3d]]></category>
		<category><![CDATA[racing]]></category>
		<category><![CDATA[racing game]]></category>

		<guid isPermaLink="false">http://www.everydayflash.com/blog/?p=51</guid>
		<description><![CDATA[Take a test drive with a powerful Mustang GT in a desert scenery! This demo features a car model imported from Maya into Papervision3D. It uses some home-made physics to simulate the car movement and a couple of new AS3Dmod features to manage the model (more below). I created this demo together with Krister Karlsson. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/flash/mustang/" target="_blank"><img src="/flash/mustang/mustang.jpg" width="520" height="200" border="0" alt="Mustang GT | Maya, Papervision3D"></a></p>
<p>Take a test drive with a powerful <strong>Mustang GT</strong> in a desert scenery! This demo features a car model imported from Maya into Papervision3D. It uses some home-made physics to simulate the car movement and a couple of new AS3Dmod features to manage the model (more below). </p>
<p>I created this demo together with <strong>Krister Karlsson</strong>. Krister is a 3d artist working with Maya and founder of <a href="http://www.modesty.se" target="_blank">Modesty</a> - a Stockholm based creative agency. The (super)low poly Mustang used here is based on a concept model made by Krister that was <strong>later used to create an actual car!</strong> You can read more about <a href="http://modesty.se/clients/eleanor/" target="_blank">this project here</a>.</p>
<p>Working with this demo has been an occasion for me to explore all the spectrum of Flash 3D related development, like importing and managing a <strong>complex model</strong>, adding interaction and scripting <strong>car physics</strong>. All this with a reasonable performance in mind, of course. </p>
<p>There is quite a lot of source code involved in this demo. I won't be publishing it all as parts of it are rather messy. Instead I'll focus on some <strong>particular problems</strong> I've encountered and solutions to them.</p>
<p><strong>Pivots.</strong> I can't tell if this is a problem of the <a href="http://sourceforge.net/projects/colladamaya/" target="_blank">Maya Collada Exporter</a> or if we have been doing something wrong, but the fact remains that <strong>moving the pivot point of an object in Maya is not reflected in Papervision3D</strong>. Instead, all pivot points default to the center of the whole object when the DAE file is imported.</p>
<p>To fix it, I had the idea to move the pivot point in Actionscript. Unfortunately, there isn't an easy way to do that in Papervision3D. This problem is <a href="http://www.nabble.com/changing-rotation-pivot-td14613233.html#a14613233" target="_blank">generally solved</a> by putting the DisplayObject3D inside another and move it in relation to its parent. But when all the objects are part of a structured DAE it becomes quite painful and requires additional steps. So instead, I wrote a modifier that takes care of that. It's called <a href="http://code.google.com/p/as3dmod/source/browse/trunk/src/com/as3dmod/modifiers/Pivot.as" target="_blank"><strong>Pivot</strong></a>, and this is the way it works:</p>
<div class="igBar"><span id="lactionscript-9"><a href="#" onclick="javascript:showPlainTxt('actionscript-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-9">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> do3d:Cube = <span style="color: #000000; font-weight: bold;">new</span> Cube<span style="color: #66cc66;">&#40;</span>materials, <span style="color: #cc66cc;color:#800000;">200</span>, <span style="color: #cc66cc;color:#800000;">200</span>, <span style="color: #cc66cc;color:#800000;">200</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> stack:ModifierStack = <span style="color: #000000; font-weight: bold;">new</span> ModifierStack<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> LibraryPv3d<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, do3d<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> pivot:Pivot = <span style="color: #000000; font-weight: bold;">new</span> Pivot<span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">200</span>,-<span style="color: #cc66cc;color:#800000;">200</span>,-<span style="color: #cc66cc;color:#800000;">200</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stack.<span style="color: #006600;">addModifier</span><span style="color: #66cc66;">&#40;</span>pivot<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stack.<span style="color: #006600;">collapse</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This piece of code will move the pivot point <strong>-200 units on all 3 axes</strong>. In case of this cube it will end up in the lower left corner. It does it without creating any additional display objects, but rather by offsetting all the objects vertices.</p>
<p>Please note that I collapse the stack after applying the pivot. Otherwise the pivot would be moved at every call to <code>stack.apply()</code>, which is not what we are looking here for.</p>
<p>The problem with the Mustang model was that all 4 wheels were rotating around the center of the car rather then around individual centers of each object. I needed to move the pivot point to the center of each wheel. I thought that moving the pivot to the geometrical center of the object is a typical thing to do, so I create a shortcut method for it:</p>
<div class="igBar"><span id="lactionscript-10"><a href="#" onclick="javascript:showPlainTxt('actionscript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-10">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pivot.<span style="color: #006600;">setMeshCenter</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Calling this function automatically sets the pivot point in the geometrical <strong>center of the mesh</strong>. At this point I thought I was done with the wheels, but there was one more problem...</p>
<p><strong>Roll &#038; steer</strong>. I think anyone who ever created an interactive 3d car model must have faced this one. <strong>A wheel rolls around the Z axis and the steering goes along it's Y axis</strong>. So, the first think that came to my mind when I started to code it was:</p>
<div class="igBar"><span id="lactionscript-11"><a href="#" onclick="javascript:showPlainTxt('actionscript-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-11">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wheel.<span style="color: #006600;">rotationZ</span> += <span style="color: #cc66cc;color:#800000;">10</span>; <span style="color: #808080; font-style: italic;">// roll 10 degrees</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wheel.<span style="color: #006600;">rotationY</span> = <span style="color: #cc66cc;color:#800000;">30</span>; <span style="color: #808080; font-style: italic;">// turn 30 degrees </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>While this code seems perfectly logical, when put in action <strong>things go wrong</strong> and the wheel starts to act like if the car had undergone a severe crash.</p>
<p>The reason for this is that once the wheel rotates along the Y axis (turns), the Z axis is no longer the right axis for roll. The correct axis would be the Z axis rotated 30 degrees on the XZ plane. </p>
<p>Again, a solution would be to enclose the wheel into a parent DisplayObject3D and then use the parent to steer and the child to roll. However, since I had already an elegant solution for the pivot I didn't want to <strong>clutter my model</strong> with an additional set of elements for this one either. </p>
<p>There comes the <strong><a href="http://code.google.com/p/as3dmod/source/browse/trunk/src/com/as3dmod/modifiers/Wheel.as" target="_blank">Wheel modifier</a></strong>. Apply it to an object - typically of a cylindrical shape - and use its <code>speed</code> and <code>turn</code> properties to manipulate the wheel. </p>
<div class="igBar"><span id="lactionscript-12"><a href="#" onclick="javascript:showPlainTxt('actionscript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-12">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> do3d:DisplayObject3D = dae.<span style="color: #006600;">getChildByName</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"wheel"</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> stack:ModifierStack = <span style="color: #000000; font-weight: bold;">new</span> ModifierStack<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> LibraryPv3d<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, do3d<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> wheel:Wheel = <span style="color: #000000; font-weight: bold;">new</span> Wheel<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stack.<span style="color: #006600;">addModifier</span><span style="color: #66cc66;">&#40;</span>wheel<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">...</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Please mind that it expects values in radians</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wheel.<span style="color: #006600;">turn</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> / <span style="color: #cc66cc;color:#800000;">6</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wheel.<span style="color: #006600;">speed</span> = <span style="color: #cc66cc;color:#800000;">5</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stack.<span style="color: #0066CC;">apply</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Internally the modifier applies some math to <strong>rotate the roll axis according the the current turn value</strong> so that everything looks fine and you don't need to worry about it ;) Read the <a href="http://www.everydayflash.com/flash/as3dmod/doc/com/as3dmod/modifiers/Wheel.html" target="_blank">documentation of this class</a> for more information.</p>
<p>All this new features are available in the <strong>latest SVN revision of AS3Dmod</strong>. So, go ahead and <a href="http://code.google.com/p/as3dmod/source/checkout" target="_blank">grab it </a> later. But first, <a href="/flash/mustang/" target="_blank">enjoy your ride</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.everyday3d.com/blog/index.php/2009/02/13/car-simulation-with-maya-papervision3d/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Making things walk in Flash 3D</title>
		<link>http://www.everyday3d.com/blog/index.php/2009/02/09/making-things-walk-in-flash-3d/</link>
		<comments>http://www.everyday3d.com/blog/index.php/2009/02/09/making-things-walk-in-flash-3d/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 09:06:22 +0000</pubDate>
		<dc:creator>bartek drozdz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Blender]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[as3dmod]]></category>
		<category><![CDATA[2D Animation]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[character animation]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[papervision3d]]></category>
		<category><![CDATA[running]]></category>
		<category><![CDATA[walk cycle]]></category>
		<category><![CDATA[walking]]></category>

		<guid isPermaLink="false">http://www.everydayflash.com/blog/?p=52</guid>
		<description><![CDATA[An Actionscript-based 3D bone system is something I wanted to do for a long time, but I couldn't figure out how to approach this problem for several months. A few days ago, I finally made a breakthrough. Here's a first demo I quickly put together: a 3D walk cycle. So far the only way to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.everydayflash.com/flash/walk/" target="_blank"><img src="http://www.everydayflash.com/flash/walk/walk-cycle-3d.png" border="0" alt="Walk cycle in Papervision3D" width="520" height="220" /></a></p>
<p>An <strong>Actionscript-based 3D bone system</strong> is something I wanted to do for a long time, but I couldn't figure out how to approach this problem for several months. A few days ago, I finally made a breakthrough. Here's a first demo I quickly put together: <a href="http://www.everydayflash.com/flash/walk/" target="_blank">a 3D walk cycle</a>.</p>
<p>So far the only way to have a <strong>walking character in Flash 3D</strong> was to create an animation sequence in a 3D editor and export it as an <strong>animated DAE</strong> and/or use <a href="http://cast3d.org/" target="_blank">Cast3D</a>. For sure, this method allows to achieve <a href="http://www.bajibot.com/xmas2008/" target="_blank">awesome results</a>, but it is <strong>not nearly as flexible</strong> as being able to control the animation <strong>directly from Actionscript</strong>.</p>
<p>So, how does the above demo work? First of all I created a model of <strong>pants in Blender</strong>. This is the 4th model I ever did with Blender so it not perfect, but is good enough for the job. The important part is that both legs and the waist form a <strong>single mesh</strong>.</p>
<p>After I imported the model into <a href="http://blog.papervision3d.org/" target="_blank">Papervision3D</a> I applied several <strong>Break modifiers</strong> to the model. The <a href="http://code.google.com/p/as3dmod/source/browse/trunk/src/com/as3dmod/modifiers/Break.as" target="_blank"><strong>Break modifier</strong></a> is a new class I wrote for <a href="http://code.google.com/p/as3dmod/" target="_blank">AS3Dmod</a> and is of key importance for this demo. In brief, it allows to apply rotation only to a group of vertices while leaving the rest untouched. The resulting deformation makes the mesh look like it was broken, hence the name.</p>
<p>I created a <a href="http://code.google.com/p/as3dmod/wiki/AS3Dmod_Tutorial" target="_blank">modifier stack</a> and added <strong>4 Break modifiers</strong> to the pants. One for each tight, and one for each knee. The angle for each of them can be modified separately, which allows dynamic animation. </p>
<p>You probably wonder how I did <strong>indicate which vertices belong to which part of the mesh</strong> (waist, thigh, calf) and how I even know where those parts start or end on the code level. That is crucial in creating an armature and it is also the tricky part. Most of the 3D IDEs, like 3Dsmax or Blender have some kind of visual interface that allows the user to <strong>select vertices and attach them to a bone</strong>. In AS everything is code, so this is a challenge. I must confess that for this demo I hardcoded some values and did some assumptions to make it work, but I think there is a way to make this task <strong>relatively easy</strong> or at least possible to apprehend.</p>
<p>In the long run, it would be cool if bones could be <strong>exported from 3D IDEs</strong> and <strong>exposed as objects</strong> in Actionscript. As far as I know, there isn't anything like this available for the moment. <a href="http://www.away3d.com" target="_blank">Away3D</a> supports <a href="http://www.infiniteturtles.co.uk/blog/away3d-multimario" target="_blank">collada bone animation</a> but, despite its promising name, it serves a different purpose (correct me if I am wrong.)</p>
<p>Let's go back to the demo. Once I had the Break modifiers in place and applied to the correct areas of the mesh, the rest was rather easy. To create a proper <strong>walk cycle</strong>, I just took <a href="http://www.bit-101.com/blog/" target="_blank">Keith Peters'</a> book <a href="http://www.friendsofed.com/book.html?isbn=1590597915" target="_blank"><strong>"Making Things Move"</strong></a>, Chapter 13 on <strong>Forward Kinematics</strong>, and I adapted the code from the examples.</p>
<p>In case you don't know that book, I would strongly recommend getting it. It contains all the essential stuff you need to know, if you want to call yourself a serious AS3 developer. I never leave home without it! There is also a <a href="http://www.friendsofed.com/book.html?isbn=9781430216087" target="_blank">sequel</a>, with stuff for Flash Player 10.</p>
<p>This walk cycle is only a <strong>first step</strong> to create a bone system in AS, but I wanted to share it with you without spending another few months making it fully featured. <strong>Break modifier</strong> is available in the latest <a href="http://code.google.com/p/as3dmod/" target="_blank">AS3Dmod</a> SVN repository. I should warn you however that this is a <strong>very early version</strong>, not really usable for the moment. </p>
<p>Of course, updates are coming so <strong>stay tuned!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.everyday3d.com/blog/index.php/2009/02/09/making-things-walk-in-flash-3d/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>The AS3Dmod tutorial</title>
		<link>http://www.everyday3d.com/blog/index.php/2009/01/06/the-as3dmod-tutorial/</link>
		<comments>http://www.everyday3d.com/blog/index.php/2009/01/06/the-as3dmod-tutorial/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 19:23:16 +0000</pubDate>
		<dc:creator>bartek drozdz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[as3dmod]]></category>
		<category><![CDATA[Actionscript APIs]]></category>
		<category><![CDATA[away3d]]></category>
		<category><![CDATA[papervision3d]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.everydayflash.com/blog/?p=49</guid>
		<description><![CDATA[I did some research in the blogs and on Twitter, and often when someone mentioned AS3Dmod, the recurring theme was the lack of documentation. Yeah... but creating proper documentation is such a difficult task! First of all, it's hard to find enough free time. Then, even if you find some, most of us, including me, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/as3dmod/wiki/AS3Dmod_Tutorial" target="_blank"><img src="/flash/as3dmod/as3dmod-tutorial.gif" width="520" height="200" border="0" alt="The AS3Dmod tutorial"></a></p>
<p>I did some research <strong>in the blogs and on Twitter</strong>, and often when someone mentioned AS3Dmod, the recurring theme was the <strong>lack of documentation</strong>. Yeah... but creating proper documentation is such a difficult task! </p>
<p>First of all, it's hard to find enough free time. Then, even if you find some, most of us, including me, will always find it more fun <strong>to write code instead</strong>. Eventually, I profited of the calmer period in the last 3 weeks and made some progress with that. The result is <a href="http://code.google.com/p/as3dmod/wiki/AS3Dmod_Tutorial" target="_blank"><strong>the AS3Dmod tutorial</strong></a>.</p>
<p>In the tutorial you will find answers to the following topics:</p>
<ul>
<li>how to integrate AS3Dmod with the Flash 3d engines</li>
<li>how the modifier stack works</li>
<li>how to create and apply modifiers</li>
<li>how to animate the modifier properties</li>
<li>how to use the <code>collapse</code> feature</li>
</ul>
<p>Beside the tutorial there are <a href="http://www.everydayflash.com/flash/as3dmod/doc/" target="_blank"><strong>API Docs</strong></a> available for some time now. </p>
<p>Another thing are simple <strong>interactive demos for each modifier</strong>. So far I created it for one: <strong>Skew</strong>. You <a href="http://www.everydayflash.com/flash/as3dmod/demo/skew.html" target="_blank">can view it here</a>. The demo allows to see all the properties and features of the modifier in action, instead of explaining it in writing. If this concept gets some positive feedback, I'll try to do more of those.</p>
<p>Hope you will find all this useful, and remember that feedback is very welcome (and much needed). And of course <strong>Happy New Year everyone!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.everyday3d.com/blog/index.php/2009/01/06/the-as3dmod-tutorial/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Wind simulation with modifiers and WOW Engine</title>
		<link>http://www.everyday3d.com/blog/index.php/2008/12/08/wind-simulation-wow-engine-as3dmod/</link>
		<comments>http://www.everyday3d.com/blog/index.php/2008/12/08/wind-simulation-wow-engine-as3dmod/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 08:30:22 +0000</pubDate>
		<dc:creator>bartek drozdz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Blender]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[as3dmod]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[flash physics]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[physics simulation]]></category>
		<category><![CDATA[wind simulation]]></category>
		<category><![CDATA[wow]]></category>
		<category><![CDATA[wow-engine]]></category>

		<guid isPermaLink="false">http://www.everydayflash.com/blog/?p=47</guid>
		<description><![CDATA[WOW-Engine is an Actionscript API to simulate physics in a 3d environment. The code is based on a popular 2d physics library - APE. It offers some very interesting possibilities in 3D animation, and everyone doing 3D in Flash should have it in their toolbox. WOW engine simulates a physics world model composed of entities [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.everydayflash.com/flash/pv3d/windsock/" target="_blank"><img src="http://www.everydayflash.com/flash/pv3d/windsock/windsock.jpg" border="0" alt="" width="520" height="202" /></a></p>
<p><strong><a href="http://seraf.mediabox.fr/wow-engine/as3-3d-physics-engine-wow-engine/" target="_blank">WOW-Engine</a></strong> is an Actionscript <strong>API to simulate physics in a 3d environment</strong>. The code is based on a popular 2d physics library - <a href="http://www.cove.org/ape/" target="_blank"><strong>APE</strong></a>. It offers some very interesting possibilities in 3D animation, and everyone doing 3D in Flash should have it in their toolbox.</p>
<p>WOW engine <strong>simulates a physics world model</strong> composed of entities called particles. <strong>Particles</strong> can be connected using <strong>constraints</strong> and exposed to different <strong>forces</strong> that make them move around. Some more information as well as a few tutorials can be found on the <a href="http://seraf.mediabox.fr/wow-engine/as3-3d-physics-engine-wow-engine/" target="_blank">projects home page</a>.</p>
<p>The basic technique of using WOW and 3D in Flash is to <strong>map those particles to objects on the 3D scene</strong>, and before each render read synchronize their x, y and z coordinates. But there are other ways too... On the WOW page, <a href="http://seraf.mediabox.fr/wow-engine/wow-engine-technical-advanced-demo-cloth-demo-01/" target="_blank">here</a> and <a href="http://seraf.mediabox.fr/wow-engine/wow-engine-technical-advanced-demo-cloth-demo-03/" target="_blank">here</a> you can find some examples of particles mapped not to whole objects but rather to <strong>individual vertices</strong>. </p>
<p><strong>Animation based on vertices</strong> has been my main preoccupation for some time now, so I got immediately interested. Unfortunately those WOW examples come <strong>without source code</strong>, so I had to figure that out on my own. The <a href="http://www.everydayflash.com/flash/pv3d/windsock/" target="_blank">above demo</a> comes as a result. </p>
<p>Some quick details: the windsock was modeled in <a href="http://www.blender.org" target="_blank">Blender</a> and the textures were baked using the technique I mentioned in my <a href="http://www.everydayflash.com/blog/index.php/2008/11/20/texture-baking-is-your-friend/" target="_blank">previous post</a>. On the flash side <a href="http://blog.papervision3d.org" target="_blank">Papervision3D</a> engine is used and a couple of <a href="http://code.google.com/p/as3dmod/" target="_blank">AS3Dmod</a> modifiers - <strong>Taper and Perlin</strong>.</p>
<p>This is my <strong>first experiment</strong> with <strong><a href="http://seraf.mediabox.fr/wow-engine/as3-3d-physics-engine-wow-engine/" target="_blank">WOW physics engine</a></strong>, but after getting a basic understanding of how it works, I am convinced there is a big potential in <strong>combining AS3Dmod and WOW</strong>, so more stuff will be coming hopefully!</p>
<p>As usual here's the <strong><a href="http://www.everydayflash.com/flash/pv3d/windsock/windsock.zip">source code</a></strong>. Please mind that this code is a result of a late night coding session ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.everyday3d.com/blog/index.php/2008/12/08/wind-simulation-wow-engine-as3dmod/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Paper simulation in with AS3Dmod and Away3D</title>
		<link>http://www.everyday3d.com/blog/index.php/2008/11/03/paper-simulation-as3dmod/</link>
		<comments>http://www.everyday3d.com/blog/index.php/2008/11/03/paper-simulation-as3dmod/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 09:28:09 +0000</pubDate>
		<dc:creator>bartek drozdz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[as3dmod]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[away3d]]></category>
		<category><![CDATA[bend modifier]]></category>
		<category><![CDATA[declaration of independence]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[papervision3d]]></category>
		<category><![CDATA[tweener]]></category>

		<guid isPermaLink="false">http://www.everydayflash.com/blog/?p=44</guid>
		<description><![CDATA[Since I released the bend modifier a lot of people have been asking how to bend an object not only along one of its axes, but along any angle. That was clearly a feature missing, but I also didn't have a clue ho to do that. Now, a after a good few days of struggle, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.everydayflash.com/flash/paper/" target="_blank"><img src="http://www.everydayflash.com/flash/paper/awaypaper.jpg" border="0" alt="" width="520" height="202" /></a></p>
<p>Since I released the bend modifier a lot of people have been asking how to bend an object not only along one of its axes, but <strong>along any angle</strong>. That was clearly a feature missing, but I also didn't have a clue ho to do that. Now, a after a good few days of struggle, and with a little help from my friends - <a href="http://www.everydayflash.com/flash/paper/" target="_blank">here it is</a>. </p>
<p>The Bend class now takes 3 arguments in the constructor, the third being the angle at which the bend is executed. Please mind, that this argument expects an <strong>angle in radians</strong>. In the code it looks like this:</p>
<div class="igBar"><span id="lactionscript-14"><a href="#" onclick="javascript:showPlainTxt('actionscript-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-14">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> mesh:Mesh = <span style="color: #66cc66;">&#91;</span>a mesh<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> stack:ModifierStack = </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> ModifierStack<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> LibraryAway3d<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, mesh<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> bend:Bend = <span style="color: #000000; font-weight: bold;">new</span> Bend<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>, .<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stack.<span style="color: #006600;">addModifier</span><span style="color: #66cc66;">&#40;</span>bend<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stack.<span style="color: #0066CC;">apply</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Of course, there is also a getter/setter for the <code>angle</code>, which allows to change the value dynamically, and to use libraries such as Tweener to animate it. </p>
<p>The Bend modifier is now part of the <strong><a href="http://code.google.com/p/as3dmod/" target="_blank">AS3Dmod library</a></strong>. Since AS3Dmod is cross-engine, the above demo was done <strong>with Away3D</strong>, but of course, <strong>the same functionality can be used with other engines</strong>, including Papervision3D. </p>
<p>For those of you who remember the <a href="http://www.everydayflash.com/blog/index.php/2008/06/11/bending-modifier-papervision3d/" target="_blank">initial bending demo</a>, I used a 100$ bill as a graphic element then. I thought it would fun to be consistent and to stay in the American theme. Therefore, <a href="http://www.everydayflash.com/flash/paper/" target="_blank">this time</a> you can play with the <a href="http://en.wikipedia.org/wiki/United_States_Declaration_of_Independence" target="_blank">Declaration of Independence</a>. Fans of <a href="http://www.imdb.com/title/tt0368891/" target="_blank">"National Treasure"</a> should be delighted.</p>
<p>As usual the sources are available and you can <a href="http://www.everydayflash.com/flash/paper/awaypaper.zip" target="_blank">get them here</a>. I hope you like the demo and that you will find the code useful. To compile it you need the latest versions of <a href="http://code.google.com/p/as3dmod/" target="_blank">AS3Dmod</a>, <a href="http://away3d.com/" target="_blank">Away3D</a> and <a href="http://code.google.com/p/tweener/"target="_blank">Tweener</a> libraries.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.everyday3d.com/blog/index.php/2008/11/03/paper-simulation-as3dmod/feed/</wfw:commentRss>
		<slash:comments>58</slash:comments>
		</item>
	</channel>
</rss>
