<?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>Psyked &#187; Box2D</title>
	<atom:link href="http://www.psyked.co.uk/category/box2d/feed" rel="self" type="application/rss+xml" />
	<link>http://www.psyked.co.uk</link>
	<description></description>
	<lastBuildDate>Fri, 27 Jan 2012 15:02:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>quickb2 &#8211; Box2D for Flash games.</title>
		<link>http://www.psyked.co.uk/flash/quickb2-box2d-for-flash-games.htm</link>
		<comments>http://www.psyked.co.uk/flash/quickb2-box2d-for-flash-games.htm#comments</comments>
		<pubDate>Sun, 11 Sep 2011 15:46:51 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Box2D]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[QuickB2 is a complete abstraction of Box2D, providing grouped hierarchies, extensible classes, and event-driven callbacks. The high-level interface enables developers to create physics simulations that are impractical to write using Box2D&#8217;s API alone. It takes care of things that you don&#8217;t want to, so that you can concentrate on your game. Here are some examples [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://quickb2.dougkoellmer.com/bin/qb2DemoReel.swf"><img class="alignnone size-full wp-image-1375" title="quickb2 screenshot" src="http://uploads.psyked.co.uk/2011/09/quickb2.png" alt="" width="500" height="280" /></a></p>
<blockquote><p>QuickB2 is a complete abstraction of Box2D, providing grouped hierarchies, extensible classes, and event-driven callbacks. The high-level interface enables developers to create physics simulations that are impractical to write using Box2D&#8217;s API alone. It takes care of things that you don&#8217;t want to, so that you can concentrate on your game.</p>
<p>Here are some examples of what it can do: <a href="http://quickb2.dougkoellmer.com/bin/qb2DemoReel.swf" rel="nofollow">http://quickb2.dougkoellmer.com/bin/qb2DemoReel.swf<br />
</a><br />
Here is a place where you can ask questions: <a href="http://quickb2.dougkoellmer.com/forum" rel="nofollow">http://quickb2.dougkoellmer.com/forum</a></p></blockquote>
<p>I&#8217;ve just gone and looked through the demo reel, and I have to say this is quite impressive. Obviously having a nicer to use, ActionScript 3 style syntax rather than the C++ syntax is a bonus, but what really makes this cool is the features that this library has, over and above the basics of Box2D.  Things like shape cutting, soft bodies; breakable joints etcetera.</p>
<p>You can find out more information, and download the source code from Google Code, at: <a href="http://code.google.com/p/quickb2/">http://code.google.com/p/quickb2/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/flash/quickb2-box2d-for-flash-games.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A more advanced StarRequests, Simple-Box2D &amp; Flickr example.</title>
		<link>http://www.psyked.co.uk/box2d/a-more-advanced-starrequests-simple-box2d-flickr-example.htm</link>
		<comments>http://www.psyked.co.uk/box2d/a-more-advanced-starrequests-simple-box2d-flickr-example.htm#comments</comments>
		<pubDate>Thu, 01 Jul 2010 08:00:28 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Box2D]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Main_388220129"
			class="flashmovie"
			width="500"
			height="560">
	<param name="movie" value="http://uploads.psyked.co.uk/2010/07/Main.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://uploads.psyked.co.uk/2010/07/Main.swf"
			name="fm_Main_388220129"
			width="500"
			height="560">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> Just a little demo I&#8217;ve been working on, following my previous post: http://www.psyked.co.uk/actionscript/starrequests-simple-box2d-flickr-mashup-sample.htm. I&#8217;ve basically updated the code a little and swapped out the rectangular Box2D objects for star-shaped Box2D objects, and the code is available on GitHub: http://github.com/psyked/StarRequests-Examples/tree/master/Box2d-Flickr-Shapes/]]></description>
			<content:encoded><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Main_1099102953"
			class="flashmovie"
			width="500"
			height="560">
	<param name="movie" value="http://uploads.psyked.co.uk/2010/07/Main.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://uploads.psyked.co.uk/2010/07/Main.swf"
			name="fm_Main_1099102953"
			width="500"
			height="560">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Just a little demo I&#8217;ve been working on, following my previous post: <a href="http://www.psyked.co.uk/actionscript/starrequests-simple-box2d-flickr-mashup-sample.htm">http://www.psyked.co.uk/actionscript/starrequests-simple-box2d-flickr-mashup-sample.htm</a>. I&#8217;ve basically updated the code a little and swapped out the rectangular Box2D objects for star-shaped Box2D objects, and the code is available on GitHub: <a href="http://github.com/psyked/StarRequests-Examples/tree/master/Box2d-Flickr-Shapes/">http://github.com/psyked/StarRequests-Examples/tree/master/Box2d-Flickr-Shapes/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/box2d/a-more-advanced-starrequests-simple-box2d-flickr-example.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Box2D &#8211; Better, cleverer, more optimised.</title>
		<link>http://www.psyked.co.uk/box2d/simple-box2d-better-cleverer-more-optimised.htm</link>
		<comments>http://www.psyked.co.uk/box2d/simple-box2d-better-cleverer-more-optimised.htm#comments</comments>
		<pubDate>Wed, 03 Feb 2010 08:29:44 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Box2D]]></category>
		<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[^ This time, that&#8217;s an image &#8211; saves on the page rendering time! Another update on the Box2D classes I&#8217;m working on.  No new features, but some pretty cool expansions and improvements to the library object creation. If you check out the previous post, you&#8217;ll see that the the dynamically drawn shapes weren&#8217;t exactly perfect; [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1170" title="box2d-shapes-2" src="http://uploads.psyked.co.uk/2010/02/box2d-shapes-2.jpg" alt="" width="500" height="280" /></p>
<p><em>^ This time, that&#8217;s an image &#8211; saves on the page rendering time!</em></p>
<p>Another update on the Box2D classes I&#8217;m working on.  No new features, but some pretty cool expansions and improvements to the library object creation.</p>
<p>If you check out <a href="http://www.psyked.co.uk/box2d/demo-source-simple-box2d-with-curved-edges.htm" target="_self">the previous post</a>, you&#8217;ll see that the the dynamically drawn shapes weren&#8217;t exactly perfect; nor were they very efficient.  Oh they worked fine, and traced the detail of the shape very well &#8211; but it took a decent chunk of system resources to animate and ended up with some overlaid shapes; which all made the Box2D a bit sluggish and the behaviours buggy.</p>
<p><span id="more-1169"></span>So, stealing incorporating ideas from other projects has been the name of the game &#8211; namely the ear clipping optimisation code from <a href="http://www.splashdust.net/2009/10/box2d-mouse-drawing-now-with-ear-clipping/" target="_blank">Splashdust.net</a>, combined with some of my own cobbled-together more optimised code for tracing curved edges.</p>
<h3>Live demo:</h3>
<p>Mouse interaction is enabled in the below example &#8211; click and drag the objects to check out how it works.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_LettersExperiment_171769921"
			class="flashmovie"
			width="500"
			height="280">
	<param name="movie" value="http://uploads.psyked.co.uk/2010/02/LettersExperiment.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://uploads.psyked.co.uk/2010/02/LettersExperiment.swf"
			name="fm_LettersExperiment_171769921"
			width="500"
			height="280">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h3><a href="http://uploads.psyked.co.uk/2010/02/simplebox2d_demo_100202.zip" target="_self">Download the source code for this demo.</a></h3>
<p>* The source code isn&#8217;t exactly cleaned up &#8211; sometime, eventually, it will be.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/box2d/simple-box2d-better-cleverer-more-optimised.htm/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Demo &amp; Source: Simple Box2D, with curved edges!</title>
		<link>http://www.psyked.co.uk/box2d/demo-source-simple-box2d-with-curved-edges.htm</link>
		<comments>http://www.psyked.co.uk/box2d/demo-source-simple-box2d-with-curved-edges.htm#comments</comments>
		<pubDate>Wed, 13 Jan 2010 23:38:35 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Box2D]]></category>
		<category><![CDATA[ActionScript Classes]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[&#160; 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_CurvedShapeExample_1996151564"
			class="flashmovie"
			width="500"
			height="280">
	<param name="movie" value="http://uploads.psyked.co.uk/2010/01/CurvedShapeExample.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://uploads.psyked.co.uk/2010/01/CurvedShapeExample.swf"
			name="fm_CurvedShapeExample_1996151564"
			width="500"
			height="280">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> (The image above this text is actually the Flash movie, if you hadn&#8217;t guessed.  Try using your mouse to interact.  If it&#8217;s blank, then something&#8217;s gone wrong!) I&#8217;ve been busy working on my Box2D classes again. (As before here and here.)  I&#8217;m not quite ready to go through the [...]]]></description>
			<content:encoded><![CDATA[<p><span style="">&nbsp;</span><br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_CurvedShapeExample_609396049"
			class="flashmovie"
			width="500"
			height="280">
	<param name="movie" value="http://uploads.psyked.co.uk/2010/01/CurvedShapeExample.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://uploads.psyked.co.uk/2010/01/CurvedShapeExample.swf"
			name="fm_CurvedShapeExample_609396049"
			width="500"
			height="280">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><span style="color: #999999;">(The image above this text is actually the Flash movie, if you hadn&#8217;t guessed.  Try using your mouse to interact.  If it&#8217;s blank, then something&#8217;s gone wrong!)</span></p>
<p>I&#8217;ve been busy working on my Box2D classes again. (As before <a href="http://www.psyked.co.uk/actionscript/simplifying-box2das3.htm" target="_blank">here</a> and <a href="http://www.psyked.co.uk/box2d/simple-box2d-custom-polygon-creation.htm" target="_blank">here</a>.)  I&#8217;m not quite ready to go through the code with some tutorials yet, but you can <a href="http://uploads.psyked.co.uk/2010/01/simplebox2d_demo_100113.zip" target="_self">download the source for this demo here</a>.  This version has had a bit more of a proper code cleanup &#8211; I&#8217;ve un-hacked some hacks I did earlier in development, and added a few more utility functions, but most importantly this version supports SWF library asset importing of multiple shapes, and shapes with curved edges (which it couldn&#8217;t do previously).</p>
<p>I feel like I should put that in bold or something, because it&#8217;s probably my most-clever bit of code to date.  I&#8217;m going to settle for saying it twice though: You can import library objects with multiple shapes, and shapes with curved and straight edges.  Have a look at the screenshot below and compare it with the Box2D display;</p>
<p><strong>In Flash IDE:</strong></p>
<p><strong><a href="http://uploads.psyked.co.uk/2010/01/flashview.jpg"><img class="alignnone size-full wp-image-1117" title="flashview" src="http://uploads.psyked.co.uk/2010/01/flashview.jpg" alt="" width="500" height="280" /></a></strong></p>
<p><strong>In Box2D:</strong></p>
<p><strong><a href="http://uploads.psyked.co.uk/2010/01/box2dview.jpg"><img class="alignnone size-full wp-image-1118" title="box2dview" src="http://uploads.psyked.co.uk/2010/01/box2dview.jpg" alt="" width="500" height="280" /></a></strong></p>
<p>You can <a href="http://uploads.psyked.co.uk/2010/01/simplebox2d_demo_100113.zip" target="_self">download the source for this demo here</a>.</p>
<p>I&#8217;m going to get this as a project on some publicly-available source repository soon.  I&#8217;d love to hear feedback on it now though!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/box2d/demo-source-simple-box2d-with-curved-edges.htm/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Simple Box2D &#8211; Custom Polygon creation.</title>
		<link>http://www.psyked.co.uk/box2d/simple-box2d-custom-polygon-creation.htm</link>
		<comments>http://www.psyked.co.uk/box2d/simple-box2d-custom-polygon-creation.htm#comments</comments>
		<pubDate>Mon, 11 Jan 2010 08:09:33 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Box2D]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ActionScript 3]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I&#8217;ve been working on some classes to simplify Box2D for Actionscript developers (See previous post for a quick intro).  The latest update to these classes introduces couple of minor ideas, and one gosh-darned awesome idea, if I do say so myself.  Let&#8217;s start with the awesome things, and move on from there&#8230; Awesome thing: Creating [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on some classes to simplify Box2D for Actionscript developers (See <a href="http://www.psyked.co.uk/actionscript/simplifying-box2das3.htm" target="_self">previous post</a> for a quick intro).  The latest update to these classes introduces couple of minor ideas, and one gosh-darned awesome idea, if I do say so myself.  Let&#8217;s start with the awesome things, and move on from there&#8230;</p>
<h3>Awesome thing: Creating Custom Polygons</h3>
<p>Or rather the methods for creating them.  Shapes in Box2D come in three basic flavours &#8211; circle, rectangle and custom polygon.  Moreover, everything must be convex (no inny bits), have no more than 8 sides, and can&#8217;t have holes.  On the plus side you can still make larger, more complex objects out of smaller ones &#8211; but it all involves a lot of thinking.</p>
<p>So, here&#8217;s the solution &#8211; or rather, the options.</p>
<p><strong>Polygon creation option #1 &#8211; Creating a polygon from an array of points.</strong></p>
<p>Using some clever triangulation code from <a href="http://www.splashdust.net/2009/10/box2d-mouse-drawing-now-with-ear-clipping/" target="_blank">Splashdust.net</a>, there&#8217;s a simple method for creating any custom shape from an array of Point objects.  With this method you can create a shape with any number of sides, and not worry about whether the shape is concave or convex.  It&#8217;ll still break if the edges of your shape interest each other, and doesn&#8217;t support holes in the objects you&#8217;re creating, but it&#8217;s a start.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ComplexPolygonExample_609663490"
			class="flashmovie"
			width="500"
			height="280">
	<param name="movie" value="http://uploads.psyked.co.uk/2010/01/ComplexPolygonExample.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://uploads.psyked.co.uk/2010/01/ComplexPolygonExample.swf"
			name="fm_ComplexPolygonExample_609663490"
			width="500"
			height="280">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre class="brush: javascript">
var array:Array = [ new Point( 0, 0 ), new Point( 10, 0 ), new Point( 10, 10 ), new Point( 20, 10 ), new Point( 20, 0 ), new Point( 30, 0 ), new Point( 30, 30 ), new Point( 0, 30 ) ];

world.createComplexPolygon( 50, 50, array );
</pre>
<p><strong>Polygon creation option #2 &#8211; Creating a polygon from a shape in a library.</strong></p>
<p><strong><a href="http://uploads.psyked.co.uk/2010/01/flashshapedemo.jpg"><img class="alignnone size-full wp-image-1107" title="flashshapedemo" src="http://uploads.psyked.co.uk/2010/01/flashshapedemo.jpg" alt="" width="500" height="280" /></a></strong></p>
<p>This is where things get cool.  Creating a shape from a series of points is all well and good, but it&#8217;s a laborious process to set up and modify.  You can create a shape in the Flash IDE, add your symbol to your library and import it to Box2D.  Currently this method only supports single shapes on a single layer, and only straight edges &#8211; but multiple shapes, layers and curved edges are definitely on the list for the future.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_LibraryShapeExample_2078682209"
			class="flashmovie"
			width="500"
			height="280">
	<param name="movie" value="http://uploads.psyked.co.uk/2010/01/LibraryShapeExample.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://uploads.psyked.co.uk/2010/01/LibraryShapeExample.swf"
			name="fm_LibraryShapeExample_2078682209"
			width="500"
			height="280">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre class="brush: javascript">
world.createPolyFromLibraryShape( 300, 100, &quot;sampleShape&quot;, &quot;vectorassets.swf&quot; );
</pre>
<p><span id="more-1097"></span></p>
<h3>Minor thing #1: Mouse interaction</h3>
<p>What fun is a simulation if you can&#8217;t interact with it? So we now have an easy way to add mouse joints to move things about.  In the next version it&#8217;s my plan to add a method for filtering out objects, presumably based on each bodies userData.</p>
<pre>world.mouseInteraction = true;</pre>
<h3>Minor thing #2: Framerate-independent animation.</h3>
<p>I stole this idea wholeheartedly from <a href="http://actionsnippet.com/?p=1471" target="_blank">QuickBox2D</a>.  Too good an idea to pass up I&#8217;m afraid, this just means that the simulation of the Box2D world is based on a timer, not a framerate.  In theory then, the simulation doesn&#8217;t slow down or speed up depending on the framerate &#8211; which is useful for many things, like graphic-intensive applications and/or memory optimisation.</p>
<pre>world.framerateIndependantAnimation = true;</pre>
<p>And here&#8217;s some code for a quick example with framerate independent animation and mouse interaction enabled;</p>
<pre class="brush: javascript">
var options:Box2DWorldOptions = new Box2DWorldOptions( 500, 280, 30, 9.8 );
options.setWorldEdges( true, true, true, true );
var world:Box2DWorld = Box2DUtils.createBoxedWorld( options );
world.debugDraw = true;
world.mouseInteractExclusions = new Array();
world.mouseInteraction = true;
world.framerateIndependantAnimation = true;
addChild( world );
</pre>
<p>I&#8217;ve compiled all of my source files into a handy project file if you want to take a look.  Documentation and comments are a bit sparse, but hopefully it&#8217;ll prove useful!</p>
<h2><a href="http://uploads.psyked.co.uk/2010/01/box2dutils.zip" target="_blank">Download the project files [Zip, 48kb]</a></h2>
<p><a href="http://uploads.psyked.co.uk/2010/01/simples.jpg"><img class="alignnone size-full wp-image-1098" title="simples" src="http://uploads.psyked.co.uk/2010/01/simples.jpg" alt="" width="500" height="280" /></a></p>
<p>Simples!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/box2d/simple-box2d-custom-polygon-creation.htm/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 1/29 queries in 0.014 seconds using disk: basic
Object Caching 789/838 objects using disk: basic

Served from: www.psyked.co.uk @ 2012-02-08 22:50:08 -->
