<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0">

<channel>
	<title>The Stem</title>
	
	<link>http://blog.thestem.ca</link>
	<description>Brett Forsyth's professional work showcase, photos, and ramblings.</description>
	<lastBuildDate>Tue, 22 Feb 2011 18:00:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/thestem" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="thestem" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>56.0</geo:lat><geo:long>113.55</geo:long><item>
		<title>Tentacle(s)</title>
		<link>http://blog.thestem.ca/archives/117</link>
		<comments>http://blog.thestem.ca/archives/117#comments</comments>
		<pubDate>Tue, 22 Feb 2011 18:00:47 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=117</guid>
		<description><![CDATA[To force myself to finish my tentacle experiment I am going to post what I have achieved so far. I have to give credit where credit is due though. I didn&#8217;t really do much of the hard work Grant Skinner, Keith Peters and Jelger Muylaert are to thank for that. I still want to add [...]]]></description>
			<content:encoded><![CDATA[<p>To force myself to finish my tentacle experiment I am going to post what I have achieved so far. I have to give credit where credit is due though. I didn&#8217;t really do much of the hard work <a href="http://gskinner.com/blog">Grant Skinner</a>, <a href="http://www.bit-101.com">Keith Peters</a> and <a href="http://labs.review.one-agency.be/labs/curvetest/">Jelger Muylaert</a> are to thank for that. I still want to add joint limits and elastics. Source code to come.</p>
<div id="tentacle">If you are seeing this you need to enable javascript.</div>
<p><script type="text/javascript">/*<!--*/var so = new SWFObject("http://blog.thestem.ca/wp-content/flash/tentaclev1.swf", "tentacle", "400", "400", "10", "#ffffff"); so.write("tentacle");/*-->*/</script></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=nKBfU_udYgk:1eMHzFw4Yg0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/117/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Back after 2 years… I have reasons</title>
		<link>http://blog.thestem.ca/archives/114</link>
		<comments>http://blog.thestem.ca/archives/114#comments</comments>
		<pubDate>Wed, 16 Feb 2011 17:54:18 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=114</guid>
		<description><![CDATA[2 years seems to pass quickly doesn&#8217;t it? My life has changed a tremendous amount in that time. Lost a partner to cancer, had 2 kids, got married again, became a step dad to a daughter, ran a design program for a year, turned 30, bought a home, and currently 7 months into a one [...]]]></description>
			<content:encoded><![CDATA[<p>2 years seems to pass quickly doesn&#8217;t it? My life has changed a tremendous amount in that time. Lost a partner to cancer, had 2 kids, got married again, became a step dad to a daughter, ran a design program for a year, turned 30, bought a home, and currently 7 months into a one year sabbatical. Which I guess is the long way of saying I haven&#8217;t been doing much programming or tinkering lately but that is all starting to change. I have several projects in the embryonic stages that I hope to share soon. The usual suspects: Flash, Arduino, multi-touch and maybe a bit of mobile dev. Check back soon to see if I can actually follow though. </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=mNXVRl9Po8c:knZZN7RdXyI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/114/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flashduino at FITC Toronto 09</title>
		<link>http://blog.thestem.ca/archives/110</link>
		<comments>http://blog.thestem.ca/archives/110#comments</comments>
		<pubDate>Sat, 04 Apr 2009 20:26:45 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Speaking]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=110</guid>
		<description><![CDATA[I have been working hard on creating some interesting stuff for the Flashduino talk I am giving at FITC this year. Below is the first video made using a prototype circuit and Flash code for time-lapse photography. By the time of the presentation this will be refined into an open source DIY Arduino shield. Who [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working hard on creating some interesting stuff for the <a href="http://www.fitc.ca/presentation_detail.cfm?festival_id=79&#038;presentation_id=791">Flashduino</a> talk I am giving at <a href="http://www.fitc.ca/event_detail.cfm?festival_id=79">FITC</a> this year. Below is the first video made using a prototype circuit and Flash code for time-lapse photography. By the time of the presentation this will be refined into an open source DIY <a href="http://www.arduino.cc">Arduino</a> shield. Who knows I might build a couple extra and give them away at the presentation. </p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3997699&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=3997699&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><br /><a href="http://vimeo.com/3997699">Time-lapse created with Arduino and Flash</a> from <a href="http://vimeo.com/brettf">Brett Forsyth </a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=m2tuoATEBRw:stCubBMfFHg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/110/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting Up Popforge for Flex Newbies</title>
		<link>http://blog.thestem.ca/archives/106</link>
		<comments>http://blog.thestem.ca/archives/106#comments</comments>
		<pubDate>Mon, 06 Oct 2008 18:00:27 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=106</guid>
		<description><![CDATA[I have to admit that I have been shying away from Flex for a long time now. I think this has to do with a general hatred for making forms based applications. Now before people tell me Flex isn&#8217;t just about forms based applications, I know, I know. Flex is actually pretty cool but in [...]]]></description>
			<content:encoded><![CDATA[<p>I have to admit that I have been shying away from <a href="http://www.adobe.com/products/flex/?promoid=BPDEQ">Flex</a> for a long time now. I think this has to do with a general hatred for making forms based applications. Now before people tell me Flex isn&#8217;t just about forms based applications, I know, I know. Flex is actually pretty cool but in general the types of work I see people using Flex for I don&#8217;t want a part of. I also know that I have been missing out on a better development IDE in Flex or <a href="http://fdt.powerflasher.com/">FDT</a> or <a href="http://www.flashdevelop.org/">FlashDevelop</a> for that matter. And in the case of <a href="http://code.google.com/p/popforge/">Popforge</a>, a really cool set of libraries by <a href="http://blog.andre-michelle.com/">Andre Michelle</a> and <a href="http://blog.joa-ebert.com/">Joa Ebert</a>, Flex is a requirement for use. </p>
<p><strong>Easy Popforge Setup</strong><br />
I will start by showing you what turns out to be an easy way to get started with the popforge library.<br />
Step 1. Get a SVN Client. On the mac I suggest you check out <a href="http://versionsapp.com/">Versions</a> and on the PC there is the old faithful <a href="http://tortoisesvn.tigris.org/">Tortoise</a>.<br />
Step 2. Check out the <a href="http://code.google.com/p/popforge/source/checkout">popforge source</a>.<br />
Step 3. Create a new AS Project in Flex (download <a href="http://www.adobe.com/products/flex/?promoid=BPDEQ">here</a> if you don&#8217;t have it yet). Click Next after entering a project name. In the source path window select add folder. Navigate to &#8220;pathToPopforge/flash/PopforgeLibrary/src&#8221; and click ok.<br />
Step 4. Click finish.<br />
Step 4. Rejoice because you are done!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=zJy74WTfIhs:bTjsbs_Ys3M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/106/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Multi-touch Crop</title>
		<link>http://blog.thestem.ca/archives/109</link>
		<comments>http://blog.thestem.ca/archives/109#comments</comments>
		<pubDate>Fri, 26 Sep 2008 20:09:59 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Multi-touch]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=109</guid>
		<description><![CDATA[I have recently changed the final student project in my OOP class to a multi-touch app. One of the briefs I gave to students was to do a non-destructive crop on the multi-touch. Two students, Jae-Ho Yoo and Morgan Roddick made a short video of it in action and I thought I would share. Check [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently changed the final student project in my OOP class to a multi-touch app. One of the briefs I gave to students was to do a non-destructive crop on the multi-touch. Two students, <a href="http://dd.ourvfs.com/dd11jaeho/wordpress/">Jae-Ho Yoo</a> and <a href="http://tismadness.com/">Morgan Roddick</a> made a short video of it in action and I thought I would share. Check it out and give them some feedback, I am sure they would appreciate it. <object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1614427&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1614427&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object><br /><a href="http://vimeo.com/1614427?pg=embed&amp;sec=1614427">A demo of a multi-touch photo app</a> from <a href="http://vimeo.com/user394292?pg=embed&amp;sec=1614427">Jae-Ho Yoo</a> on <a href="http://vimeo.com?pg=embed&amp;sec=1614427">Vimeo</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=mXrBR9qEW1c:B0sestQUAN0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/109/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>KitchenSync, I Can Stop Using Tweener Now!</title>
		<link>http://blog.thestem.ca/archives/108</link>
		<comments>http://blog.thestem.ca/archives/108#comments</comments>
		<pubDate>Fri, 08 Aug 2008 18:30:19 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=108</guid>
		<description><![CDATA[I was alerted to KitchenSync, a AS3 tweening library by Mims Wright, on the Adobe blog feed a week or so ago. I was a bit skeptical at first of another tweening library for Flash but I have been searching for a true AS3 replacement to FUSE (I never started working with GOASAP but should [...]]]></description>
			<content:encoded><![CDATA[<p>I was alerted to <a href="http://code.google.com/p/kitchensynclib/">KitchenSync</a>, a AS3 tweening library by <a href="http://dispatchevent.org/">Mims Wright</a>, on the Adobe blog feed a week or so ago. I was a bit skeptical at first of another tweening library for Flash but I have been searching for a true AS3 replacement to <a href="http://www.mosessupposes.com/Fuse/">FUSE</a> (I never started working with <a href="http://www.goasap.org/">GOASAP</a> but should probably check it out to). <a href="http://code.google.com/p/tweener/">Tweener</a> was ok but as a teacher I prefer libraries with good documentation as it makes a students life easier, which really makes my life easier. Anyway, I had to teach an AS animation class yesterday, which I normally do with Tweener, but decided to give KS 30 minutes to blow my mind. Within 5 minutes I knew I was going to be teaching KS. Good documentation, <a href="http://code.google.com/p/kitchensynclib/wiki/ActionGroups">animation sequencing/paralleling</a>, filter tweening, a <a href="http://code.google.com/p/kitchensynclib/wiki/Roadmap">dev roadmap</a> and fast response to questions by Mims all told me KS was worth investing some time in and worth teaching to students. I hope to contribute some documentation over time and maybe a student project or two as a showcase. You should at least give it 5 minutes yourself.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=eSSjkueVrNM:_nmJBcVSB98:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/108/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Rouxbe Cooking School</title>
		<link>http://blog.thestem.ca/archives/104</link>
		<comments>http://blog.thestem.ca/archives/104#comments</comments>
		<pubDate>Mon, 21 Jul 2008 03:13:59 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Food]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=104</guid>
		<description><![CDATA[I finally found the time to check out what my good friends at Rouxbe have been up to with their newly launched cooking school. There is lots of great content already, can&#8217;t wait to do the pasta lessons, and lots more to come. Thinking I was a knife smarty pants I took the &#8220;Handling a [...]]]></description>
			<content:encoded><![CDATA[<p>I finally found the time to check out what my good friends at <a href="http://www.rouxbe.com">Rouxbe</a> have been up to with their newly launched <a href="http://rouxbe.com/school">cooking school</a>. There is lots of great content already, can&#8217;t wait to do the pasta lessons, and lots more to come. Thinking I was a knife smarty pants I took the &#8220;Handling a Chefs Knife&#8221; quiz and got a 76% (and learned a few things). Overall I wish I had checked this out earlier as I am really impressed by the content. I am going to be making some time to do all the material. You can try a free lesson on <a href="http://rouxbe.com/school/sections/81/objectives">wheat and gluten</a> and/or <a href="http://rouxbe.com/signup">sign up</a> for a free membership to check out all of Rouxbe&#8217;s great video recipes. As always I am super impressed by the quality of all the videos. Keep up the great work Rouxbe team.</p>
<p>As a full disclosure I was the original Flash developer responsible for creating all of the flash players for the Rouxbe site. They did not however ask me to write this and I am not currently working for them.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=HlN4DJXBc8w:m11NBzLcEfQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/104/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Box2D Joints #2 – Revolute Joints</title>
		<link>http://blog.thestem.ca/archives/102</link>
		<comments>http://blog.thestem.ca/archives/102#comments</comments>
		<pubDate>Mon, 14 Jul 2008 17:00:53 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=102</guid>
		<description><![CDATA[Revolute Joints Revolute joints can be used to create rotating joints (aka motors) or joints with friction. Both types can have angular limits placed on them. Take a look at the TestRagdoll, TestCrankGearsPulley and TestTheoJansen for more examples of how to use this joint type. Creating Motors The motor features of a revolute joint provide [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Revolute Joints</strong><br />
Revolute joints can be used to create rotating joints (aka motors) or joints with friction. Both types can have angular limits placed on them. Take a look at the TestRagdoll, TestCrankGearsPulley and TestTheoJansen for more examples of how to use this joint type.</p>
<p><strong>Creating Motors</strong><br />
The motor features of a revolute joint provide a lot of functionality. Just look at the Crank/Gear/Pulley and Theo Jansen Walker test bed examples for a hint of their potential. When creating a motor the maxMotorTorque is the most import property. Measured in newton meters (N•m), when using the normal units (not converted to pixels as in my example), it determines the amount of mass the motor can rotate. If your motors is not rotating or rotating poorly you likely need to increase its maxMotorTorque. Simple Motor Example:</p>
<pre class="brush: as3">//Create and setup a revolute joint as a simple motor
pivot.position.Set(80,250);
var pivotBody1:b2Body = m_world.CreateBody(pivot);
pivotBody1.CreateShape(pivotPoly)
pivotBody1.SetMassFromShapes();

var motorPoly:b2PolygonDef = new b2PolygonDef();
motorPoly.SetAsOrientedBox(30, 10, new b2Vec2(0, 0), 0);
motorPoly.friction = .3;
motorPoly.density = .01;
motorPoly.restitution = .1;
			
var motorDef:b2BodyDef = new b2BodyDef();
motorDef.position.Set(110, 250);
var motorBody:b2Body = m_world.CreateBody(motorDef);
motorBody.CreateShape(motorPoly);
motorBody.SetMassFromShapes();

//Setup the revolute joint definition for later instantiation. rjd is a predefined b2RevoluteJointDef object.
rjd.Initialize(pivotBody1, motorBody, new b2Vec2(80,250));
rjd.motorSpeed = 3;
rjd.maxMotorTorque = 10000000;
rjd.enableMotor = true;
rjd.enableLimit = false;
//Create the motor joint and cast it as a b2RevoluteJoint
var joint1:b2RevoluteJoint = m_world.CreateJoint(rjd) as b2RevoluteJoint;
</pre>
<p><strong>Limits</strong><br />
Revolute joints are not limited to continuous rotation. You can set upper and lower limits to the joint (in radians). When used with the enableMotor property set to false, this joint is ideal for simulating limbs. See the TestRagdoll example for a great demo of this.</p>
<p>Combining joint limits, motors and conditionals allows for creation of some interesting systems. I could see this used as valves, platforms in games, fins on fish, etc. In this example I have setup a motor to oscillate between its limits.</p>
<pre class="brush: as3">//Setup a limited revolute joint that oscillates between its limits
pivot.position.Set(80,100);
var pivotBody2:b2Body = m_world.CreateBody(pivot);
pivotBody2.CreateShape(pivotPoly)
pivotBody2.SetMassFromShapes();

var limitMotorPoly:b2PolygonDef = new b2PolygonDef();
limitMotorPoly.SetAsOrientedBox(30, 10, new b2Vec2(0, 0), 0);
limitMotorPoly.friction = .3;
limitMotorPoly.density = .01;
limitMotorPoly.restitution = .1;
			
var limitedMotorDef:b2BodyDef = new b2BodyDef();
limitedMotorDef.position.Set(110, 100);
var limitedMotorBody:b2Body = m_world.CreateBody(limitedMotorDef);
limitedMotorBody.CreateShape(limitMotorPoly);
limitedMotorBody.SetMassFromShapes();
			
//Setup the revolute joint definition for later instantiation
rjd.Initialize(pivotBody2, limitedMotorBody, new b2Vec2(80,100));
rjd.motorSpeed = 3;
rjd.lowerAngle = 0;
//Convert the angle in degrees to radians
rjd.upperAngle = 270*(Math.PI/180);
rjd.enableLimit = true;
rjd.maxMotorTorque = 10000000;
rjd.referenceAngle = 0;
rjd.enableMotor = true;
//Create the motor joint and cast it as a b2RevoluteJoint. Store the joint object in a class var for use later in the update method.
limitMotorJoint = m_world.CreateJoint(rjd) as b2RevoluteJoint;
</pre>
<p><strong>Friction Joints</strong><br />
Friction joints are revolute joints with the motor enabled, a non-zero maxMotorTorque and the motor speed set to 0. This will cause the joint to resist rotation but give when the maxMotorTorque is exceeded, giving the effect of a joint with friction at the pivot. Once the force to the joint is removed it stops moving. Example:</p>
<pre class="brush: as3">//Setup a friction joint
pivot.position.Set(190,100);
var pivotBody3:b2Body = m_world.CreateBody(pivot);
pivotBody3.CreateShape(pivotPoly)
pivotBody3.SetMassFromShapes();
			
var armPoly:b2PolygonDef = new b2PolygonDef();
armPoly.SetAsOrientedBox(90, 10, new b2Vec2(0, 0), 0);
armPoly.friction = .5;
armPoly.density = .01;
armPoly.restitution=0;
			
var armBodyDef:b2BodyDef = new b2BodyDef();
armBodyDef.position.Set(280,100);
var armBody = m_world.CreateBody(armBodyDef);
armBody.CreateShape(armPoly)
armBody.SetMassFromShapes();
			
rjd.Initialize(pivotBody3, armBody, new b2Vec2(190,100));
rjd.motorSpeed = 0;
rjd.maxMotorTorque = 10000000;
rjd.enableMotor = true;
rjd.enableLimit = false;
var joint2:b2RevoluteJoint = m_world.CreateJoint(rjd) as b2RevoluteJoint;
</pre>
<p>Example:</p>
<div id="revolutejoint">If you are seeing this you need to enable javascript. This is a flash example of three different uses of the Box2D revolute joint.</div>
<p><script type="text/javascript">/*<!--*/var so = new SWFObject("http://blog.thestem.ca/wp-content/flash/RevoluteJoints.swf", "revolutejoint", "400", "400", "8", "#ffffff"); so.write("revolutejoint");/*-->*/</script><br />
<a href="/wp-content/source/revolutesource.zip">Full Source not including Box2D</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=M6psmtuR8mo:bgDPaoOWrq4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/102/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Changes in Box2D 2.0.1</title>
		<link>http://blog.thestem.ca/archives/99</link>
		<comments>http://blog.thestem.ca/archives/99#comments</comments>
		<pubDate>Sun, 29 Jun 2008 19:13:17 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=99</guid>
		<description><![CDATA[With the release of the 2.0.1 update of Box2D a couple of things have changed. Here are a couple of changes I have found. If you know of more post a comment. Creating Bodies Previously when creating bodies you had to specify if the body was static or dynamic, this is no longer the case. [...]]]></description>
			<content:encoded><![CDATA[<p>With the release of the <a href="http://sourceforge.net/projects/box2dflash">2.0.1 update</a> of Box2D a couple of things have changed. Here are a couple of changes I have found. If you know of more post a comment.</p>
<p><strong>Creating Bodies</strong><br />
Previously when creating bodies you had to specify if the body was static or dynamic, this is no longer the case. The engine itself will determine the body type based on its density setting. If you set the density of the shapes to 0 the body will be static and any non-zero value will make it dynamic. Example:</p>
<pre class="brush: as3">//Create a static body
var staticPoly:b2PolygonDef = new b2PolygonDef();
staticPoly.SetAsOrientedBox(10, 10, new b2Vec2(0, 0), 0);
staticPoly.friction = .5;
//Setting the density to 0 will make the body that contains this poly static
staticPoly.density = 0;
staticPoly.restitution=0;

var staticBodyDef:b2BodyDef = new b2BodyDef();
staticBodyDef.position.Set(0,0);
var staticBody = m_world.CreateBody(staticBodyDef);
//New shape instantiation does not need to define static or dynamic
staticBody.CreateShape(staticPoly)
staticBody.SetMassFromShapes();

//Create a dynamic body
var dynamicPoly:b2PolygonDef = new b2PolygonDef();
dynamicPoly.SetAsOrientedBox(10, 10, new b2Vec2(0, 0), 0);
dynamicPoly.friction = .5;
//Setting the density to any value greater then 0 will make the body that contains this poly dynamic
dynamicPoly.density = 1;
dynamicPoly.restitution=0;

var dynamicBodyDef:b2BodyDef = new b2BodyDef();
dynamicBodyDef.position.Set(0,0);
var dynamicBody = m_world.CreateBody(dynamicBodyDef);
//New shape instantiation does not need to define static or dynamic
dynamicBody.CreateShape(dynamicPoly)
dynamicBody.SetMassFromShapes();
</pre>
<p><strong>Distance Joints</strong><br />
A couple of minor changes have been made to the distance joint type. It now includes a dampening factor and a frequency. I can&#8217;t really seem to figure out what they do though. I am probably wrong but I don&#8217;t think they are working properly in flash yet.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=9pDdwpiVm8Q:cNVPM4_J_ss:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/99/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Box2D Joints #1 – Distance Joints</title>
		<link>http://blog.thestem.ca/archives/98</link>
		<comments>http://blog.thestem.ca/archives/98#comments</comments>
		<pubDate>Fri, 20 Jun 2008 17:30:21 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=98</guid>
		<description><![CDATA[Joints are one of the most interesting parts of Box2D. Over the next several weeks I will attempt to explain all of the Box2D joint types and possibly add a new one. Before You Start I have switched over to pixels as my primary unit for working with Box2D. This was done by changing the [...]]]></description>
			<content:encoded><![CDATA[<p>Joints are one of the most interesting parts of Box2D. Over the next several weeks I will attempt to explain all of the Box2D joint types and possibly add a new one. </p>
<p><strong>Before You Start</strong><br />
I have switched over to pixels as my primary unit for working with Box2D. This was done by changing the scale factor and it impacts defining joints because they use N•m as their units. So now  the values used in joints will need to be 30x bigger. Nothing major but if you use the same values as the test bed examples your joint won&#8217;t work properly. This will be more important with other joint types.</p>
<p><strong>Distance Joints</strong><br />
A <a href="http://linuxuser.at/elements/doc/box2d/classb2_distance_joint.htm">distance joint</a> is the simplest of the joints to use. As the name implies it links two bodies together with a rigid connection that maintains the distance between the bodies. Each body is free to rotate and the collideConnected property of the inherited <a href="http://linuxuser.at/elements/doc/box2d/structb2_joint_def.htm">b2JointDef</a> controls whether the bodies collide. The joint itself will not collide with other objects. As with most things in Box2D the vectors that specify the connection points are relative to the world and not the bodies. Example:</p>
<pre class="brush: as3">//Create a new distance joint definition
var djd:b2DistanceJointDef = new b2DistanceJointDef();
//Initialize the joint between two bodies. The b2Vec2() objects are used to define the location of the joint ends. Values are sample only.
djd.Initialize(body1, body2, new b2Vec2(0,0),new b2Vec2(0,30));
//Define whether the two objects will be allowed to collide with each other.
djd.collideConnected = true;
var distJoint:b2DistanceJoint = m_world.CreateJoint(djd);
</pre>
<p>Example:</p>
<div id="distancejoint">Don&#8217;t have flash? <a href="http://www.adobe.com/products/flashplayer/">Get it </a></div>
<p><script type="text/javascript">/*<!--*/var so = new SWFObject("http://blog.thestem.ca/wp-content/flash/distancejoint.swf", "distancejoint", "400", "400", "8", "#ffffff"); so.write("distancejoint");/*-->*/</script></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/thestem?a=kBALuZ_9RzQ:-ICUTkYVhWU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/thestem?d=yIl2AUoC8zA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/98/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
