
{"id":763,"date":"2009-01-12T10:00:45","date_gmt":"2009-01-12T09:00:45","guid":{"rendered":"http:\/\/www.matthijskamstra.nl\/blog\/?p=763"},"modified":"2010-05-08T19:04:09","modified_gmt":"2010-05-08T18:04:09","slug":"hello-box2d-part-2","status":"publish","type":"post","link":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/","title":{"rendered":"Hello box2D &#8211; part 2"},"content":{"rendered":"<p>In my <a href=\"http:\/\/www.matthijskamstra.nl\/blog\/index.php\/2009\/01\/11\/hello-box2d-part-1\/\">previous post<\/a> I started with a &#8220;Hello world&#8221; for box2DFlash.<br \/>\nYou can find the original here: <a href=\"http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Hello_Box2D\">AS3: Hello Box2D<\/a>.<\/p>\n<p>When you get it working you will not be satisfied: a black swf, with only a trace in the output panel.<\/p>\n<p>Today I will make the &#8220;Hello world&#8221; more visible.<\/p>\n<h3>Debug_Drawing<\/h3>\n<blockquote><p>This the preferred method of drawing these physics entities for debugging, rather than accessing the data directly. The reason is that much of the necessary data is internal and subject to change. <\/p><\/blockquote>\n<p><em>source: <a href=\"http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Debug_Drawing\">Debug_Drawing<\/a><\/em><\/p>\n<p>Box2D has a <code>debugDraw<\/code> class that lets you see what you have built, they call it <code>DebugDraw<\/code>.<br \/>\nTake the code from <a href=\"http:\/\/www.matthijskamstra.nl\/blog\/index.php\/2009\/01\/11\/hello-box2d-part-1\/\">yesterday<\/a> and place this code before <code>Simulating_the_World<\/code> code.<br \/>\n[as]<br \/>\nvar debugDraw:b2DebugDraw = new b2DebugDraw();<br \/>\ndebugDraw.m_sprite = new Sprite();<\/p>\n<p>addChild(debugDraw.m_sprite);<\/p>\n<p>debugDraw.m_drawScale = 30;<br \/>\ndebugDraw.m_fillAlpha = .25;<br \/>\ndebugDraw.m_lineThickness = 1;<br \/>\ndebugDraw.m_drawFlags = b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit ;<br \/>\nworld.SetDebugDraw (debugDraw);<br \/>\n[\/as]<\/p>\n<div class=\"update\">Thx Boy Wonder for pointing me to a little mistake in the part of the code: I forgot the last piece of code <code>world.SetDebugDraw (debugDraw);<\/code>. The class at the bottom of the page was correct!<\/div>\n<p>So all you need to do is CTRL+ENTER.<\/p>\n<p>Nice effect isn&#8217;t it? Almost? Well at least you see something although it&#8217;s not impressive&#8230;<br \/>\nYeah, it&#8217;s isn&#8217;t much. Lets see how we can improve this.<\/p>\n<h3>Improve Debug_Drawing<\/h3>\n<p>The problem is that the debug window is created and executed 60 times, but because it is done in a for loop, you only see the end result (after 60 updates).<br \/>\nTo see animation (if you follow the trace you see that something is moving) we need to update (visible) the data in <code>dbgDraw<\/code> more and we will use the frame rate to update it (yesterday set to 60 frames).<br \/>\nBut for that there needs to be changed more than just a couple of lines<\/p>\n<p>First we need to add some variables:<br \/>\n[as]<br \/>\nprivate var world:b2World;<br \/>\nprivate var body:b2Body;<br \/>\n[\/as]<br \/>\nand change some related code:<br \/>\n[as]<br \/>\n\/\/ Construct a world object<br \/>\n\/\/ var world:b2World = new b2World(worldAABB, gravity, doSleep);  \/\/ [mck]: old code<br \/>\nworld = new b2World(worldAABB, gravity, doSleep);<br \/>\n[\/as]<br \/>\nand<br \/>\n[as]<br \/>\n\/\/ var body:b2Body = world.CreateBody(bodyDef);   \/\/ [mck]: old code<br \/>\nbody = world.CreateBody(bodyDef);<br \/>\n[\/as]<\/p>\n<p>and remove the code add at <code>Simulating_the_World<\/code> with<br \/>\n[as]<br \/>\naddEventListener(Event.ENTER_FRAME, onUpdateHandler, false, 0, true);<br \/>\n[\/as]<\/p>\n<p>and add<br \/>\n[as]<br \/>\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\/\/ http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Simulating_the_World_.28of_Box2D.29<br \/>\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\npublic function onUpdateHandler(e:Event):void{<\/p>\n<p>\tvar timeStep:Number = 1.0 \/ 60.0;<br \/>\n\tvar iterations:Number = 10;<\/p>\n<p>\tworld.Step(timeStep, iterations);<\/p>\n<p>\tvar position:b2Vec2 = body.GetPosition();<br \/>\n\tvar angle:Number = body.GetAngle();<br \/>\n\ttrace(position.x +&#8217;,&#8217;+ position.y +&#8217;,&#8217;+ angle);<br \/>\n}<br \/>\n[\/as]<\/p>\n<h3>End result<\/h3>\n<p>The document class (<code>HelloWorld.as<\/code>) will look like this:<\/p>\n<p>[as]<br \/>\npackage {<\/p>\n<p>\timport flash.display.*;<br \/>\n\timport flash.events.*;<br \/>\n\t\/\/ Box2D Classes used in this &quot;Hello world&quot;<br \/>\n\timport Box2D.Dynamics.*;<br \/>\n\timport Box2D.Collision.*;<br \/>\n\timport Box2D.Collision.Shapes.*;<br \/>\n\timport Box2D.Common.Math.*;<\/p>\n<p>\t\/\/ [SWF(width=&quot;640&quot;, height=&quot;480&quot;, backgroundColor=&quot;#000000&quot;, frameRate=&quot;60&quot;)]<br \/>\n\tpublic class HelloWorld3 extends Sprite {<\/p>\n<p>\t\tprivate var body:b2Body;<br \/>\n\t\tprivate var world:b2World;<\/p>\n<p>\t\t\/\/ constructor<br \/>\n\t\tpublic function HelloWorld() {<br \/>\n\t\t\ttrace( &quot;HelloWorld.HelloWorld&quot; );<\/p>\n<p>\t\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\t\t\/\/ http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Creating_a_World<br \/>\n\t\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\t\t\/\/ Create world AABB<br \/>\n\t\t\tvar worldAABB:b2AABB = new b2AABB();<br \/>\n\t\t\tworldAABB.lowerBound.Set(-100.0, -100.0);<br \/>\n\t\t\tworldAABB.upperBound.Set(100.0, 100.0);<\/p>\n<p>\t\t\t\/\/ Define the gravity vector<br \/>\n\t\t\tvar gravity:b2Vec2 = new b2Vec2 (0.0, -10.0); <\/p>\n<p>\t\t\t\/\/ Allow bodies to sleep<br \/>\n\t\t\tvar doSleep:Boolean = true;<\/p>\n<p>\t\t\t\/\/ Construct a world object<br \/>\n\t\t\t\/\/ var world:b2World = new b2World(worldAABB, gravity, doSleep);  \/\/ [mck]: old code<br \/>\n\t\t\tworld = new b2World(worldAABB, gravity, doSleep);<\/p>\n<p>\t\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\t\t\/\/ http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Creating_a_Ground_Box<br \/>\n\t\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\t\tvar groundBodyDef:b2BodyDef = new b2BodyDef();<br \/>\n\t\t\tgroundBodyDef.position.Set(0.0, -10.0);<\/p>\n<p>\t\t\tvar groundBody:b2Body = world.CreateBody(groundBodyDef);<\/p>\n<p>\t\t\tvar groundShapeDef:b2PolygonDef = new b2PolygonDef();<br \/>\n\t\t\tgroundShapeDef.SetAsBox(50.0, 10.0);<\/p>\n<p>\t\t\tgroundBody.CreateShape(groundShapeDef);<\/p>\n<p>\t\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\t\t\/\/ http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Creating_a_Dynamic_Body<br \/>\n\t\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\t\tvar bodyDef:b2BodyDef = new b2BodyDef();<br \/>\n\t\t\tbodyDef.position.Set(0.0, 4.0);<br \/>\n\t\t\t\/\/ var body:b2Body = world.CreateBody(bodyDef);   \/\/ [mck]: old code<br \/>\n\t\t\tbody = world.CreateBody(bodyDef);<\/p>\n<p>\t\t\tvar shapeDef:b2PolygonDef = new b2PolygonDef();<br \/>\n\t\t\tshapeDef.SetAsBox(1.0, 1.0);<br \/>\n\t\t\tshapeDef.density = 1.0;<br \/>\n\t\t\tshapeDef.friction = 0.3;<br \/>\n\t\t\tbody.CreateShape(shapeDef);<br \/>\n\t\t\tbody.SetMassFromShapes();<\/p>\n<p>\t\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\t\t\/\/ http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Debug_Drawing<br \/>\n\t\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\t\tvar debugDraw:b2DebugDraw = new b2DebugDraw();<br \/>\n\t\t\tdebugDraw.m_sprite = new Sprite();<\/p>\n<p>\t\t\taddChild(debugDraw.m_sprite);<\/p>\n<p>\t\t\tdebugDraw.m_drawScale = 30;<br \/>\n\t\t\tdebugDraw.m_fillAlpha = .25;<br \/>\n\t\t\tdebugDraw.m_lineThickness = 1;<br \/>\n\t\t\tdebugDraw.m_drawFlags = b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit ;<br \/>\n\t\t\tworld.SetDebugDraw (debugDraw);<\/p>\n<p>\t\t\t\/\/<br \/>\n\t\t\taddEventListener(Event.ENTER_FRAME, onUpdateHandler, false, 0, true);<br \/>\n\t\t}<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\t\/\/ http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Simulating_the_World_.28of_Box2D.29<br \/>\n\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tpublic function onUpdateHandler(e:Event):void{<\/p>\n<p>\t\t\tvar timeStep:Number = 1.0 \/ 60.0;<br \/>\n\t\t\tvar iterations:Number = 10;<\/p>\n<p>\t\t\tworld.Step(timeStep, iterations);<\/p>\n<p>\t\t\tvar position:b2Vec2 = body.GetPosition();<br \/>\n\t\t\tvar angle:Number = body.GetAngle();<br \/>\n\t\t\ttrace(position.x +&#8217;,&#8217;+ position.y +&#8217;,&#8217;+ angle);<br \/>\n\t\t}<\/p>\n<p>\t} \/\/ end class<\/p>\n<p>} \/\/ end package<br \/>\n[\/as]<\/p>\n<p>So all you need to do is CTRL+ENTER.<\/p>\n<p>Now we see something moving, and we have an endless stream of trace data.<\/p>\n<p>It&#8217;s better, but there is more room for improvement&#8230;<br \/>\ntomorrow more. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post I started with a &#8220;Hello world&#8221; for box2DFlash. You can find the original here: AS3: Hello Box2D. When you get it working you will not be satisfied: a black swf, with only a trace in the output panel. Today I will make the &#8220;Hello world&#8221; more visible. Debug_Drawing This the preferred [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,3],"tags":[408,230,231,398,159],"class_list":["post-763","post","type-post","status-publish","format-standard","hentry","category-as3","category-flash","tag-as3","tag-box2d","tag-box2dflash","tag-flash","tag-flashdevelop"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"In my previous post I started with a &quot;Hello world&quot; for box2DFlash. You can find the original here: AS3: Hello Box2D. When you get it working you will not be satisfied: a black swf, with only a trace in the output panel. Today I will make the &quot;Hello world&quot; more visible. Debug_Drawing This the preferred\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Matthijs Kamstra\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"[mck] | a polymath zapper\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Hello box2D \u2013 part 2 | [mck]\" \/>\n\t\t<meta property=\"og:description\" content=\"In my previous post I started with a &quot;Hello world&quot; for box2DFlash. You can find the original here: AS3: Hello Box2D. When you get it working you will not be satisfied: a black swf, with only a trace in the output panel. Today I will make the &quot;Hello world&quot; more visible. Debug_Drawing This the preferred\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2009-01-12T09:00:45+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2010-05-08T18:04:09+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Hello box2D \u2013 part 2 | [mck]\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In my previous post I started with a &quot;Hello world&quot; for box2DFlash. You can find the original here: AS3: Hello Box2D. When you get it working you will not be satisfied: a black swf, with only a trace in the output panel. Today I will make the &quot;Hello world&quot; more visible. Debug_Drawing This the preferred\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/#article\",\"name\":\"Hello box2D \\u2013 part 2 | [mck]\",\"headline\":\"Hello box2D &#8211; part 2\",\"author\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#organization\"},\"datePublished\":\"2009-01-12T10:00:45+01:00\",\"dateModified\":\"2010-05-08T19:04:09+01:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/#webpage\"},\"articleSection\":\"AS3, Flash, AS3, box2d, box2dFlash, Flash, flashdevelop\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/#listItem\",\"name\":\"Flash\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/#listItem\",\"position\":2,\"name\":\"Flash\",\"item\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/as3\\\/#listItem\",\"name\":\"AS3\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/as3\\\/#listItem\",\"position\":3,\"name\":\"AS3\",\"item\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/as3\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/#listItem\",\"name\":\"Hello box2D &#8211; part 2\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/#listItem\",\"name\":\"Flash\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/#listItem\",\"position\":4,\"name\":\"Hello box2D &#8211; part 2\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/as3\\\/#listItem\",\"name\":\"AS3\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#organization\",\"name\":\"[mck]\",\"description\":\"a polymath zapper\",\"url\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Matthijs Kamstra\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/06ff22a1197b6624946e5a3377184f11ddc00ac06a6f1d2311b9d2072bdf61b1?s=96&d=wavatar&r=g\",\"width\":96,\"height\":96,\"caption\":\"Matthijs Kamstra\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/#webpage\",\"url\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/\",\"name\":\"Hello box2D \\u2013 part 2 | [mck]\",\"description\":\"In my previous post I started with a \\\"Hello world\\\" for box2DFlash. You can find the original here: AS3: Hello Box2D. When you get it working you will not be satisfied: a black swf, with only a trace in the output panel. Today I will make the \\\"Hello world\\\" more visible. Debug_Drawing This the preferred\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/12\\\/hello-box2d-part-2\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2009-01-12T10:00:45+01:00\",\"dateModified\":\"2010-05-08T19:04:09+01:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/\",\"name\":\"[mck]\",\"description\":\"a polymath zapper\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Hello box2D \u2013 part 2 | [mck]","description":"In my previous post I started with a \"Hello world\" for box2DFlash. You can find the original here: AS3: Hello Box2D. When you get it working you will not be satisfied: a black swf, with only a trace in the output panel. Today I will make the \"Hello world\" more visible. Debug_Drawing This the preferred","canonical_url":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/#article","name":"Hello box2D \u2013 part 2 | [mck]","headline":"Hello box2D &#8211; part 2","author":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/#organization"},"datePublished":"2009-01-12T10:00:45+01:00","dateModified":"2010-05-08T19:04:09+01:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/#webpage"},"isPartOf":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/#webpage"},"articleSection":"AS3, Flash, AS3, box2d, box2dFlash, Flash, flashdevelop"},{"@type":"BreadcrumbList","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.matthijskamstra.nl\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/#listItem","name":"Flash"}},{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/#listItem","position":2,"name":"Flash","item":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/#listItem","name":"AS3"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/#listItem","position":3,"name":"AS3","item":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/#listItem","name":"Hello box2D &#8211; part 2"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/#listItem","name":"Flash"}},{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/#listItem","position":4,"name":"Hello box2D &#8211; part 2","previousItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/#listItem","name":"AS3"}}]},{"@type":"Organization","@id":"https:\/\/www.matthijskamstra.nl\/blog\/#organization","name":"[mck]","description":"a polymath zapper","url":"https:\/\/www.matthijskamstra.nl\/blog\/"},{"@type":"Person","@id":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/#author","url":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/","name":"Matthijs Kamstra","image":{"@type":"ImageObject","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/06ff22a1197b6624946e5a3377184f11ddc00ac06a6f1d2311b9d2072bdf61b1?s=96&d=wavatar&r=g","width":96,"height":96,"caption":"Matthijs Kamstra"}},{"@type":"WebPage","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/#webpage","url":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/","name":"Hello box2D \u2013 part 2 | [mck]","description":"In my previous post I started with a \"Hello world\" for box2DFlash. You can find the original here: AS3: Hello Box2D. When you get it working you will not be satisfied: a black swf, with only a trace in the output panel. Today I will make the \"Hello world\" more visible. Debug_Drawing This the preferred","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/#breadcrumblist"},"author":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/#author"},"datePublished":"2009-01-12T10:00:45+01:00","dateModified":"2010-05-08T19:04:09+01:00"},{"@type":"WebSite","@id":"https:\/\/www.matthijskamstra.nl\/blog\/#website","url":"https:\/\/www.matthijskamstra.nl\/blog\/","name":"[mck]","description":"a polymath zapper","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"[mck] | a polymath zapper","og:type":"article","og:title":"Hello box2D \u2013 part 2 | [mck]","og:description":"In my previous post I started with a &quot;Hello world&quot; for box2DFlash. You can find the original here: AS3: Hello Box2D. When you get it working you will not be satisfied: a black swf, with only a trace in the output panel. Today I will make the &quot;Hello world&quot; more visible. Debug_Drawing This the preferred","og:url":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/","article:published_time":"2009-01-12T09:00:45+00:00","article:modified_time":"2010-05-08T18:04:09+00:00","twitter:card":"summary_large_image","twitter:title":"Hello box2D \u2013 part 2 | [mck]","twitter:description":"In my previous post I started with a &quot;Hello world&quot; for box2DFlash. You can find the original here: AS3: Hello Box2D. When you get it working you will not be satisfied: a black swf, with only a trace in the output panel. Today I will make the &quot;Hello world&quot; more visible. Debug_Drawing This the preferred"},"aioseo_meta_data":{"post_id":"763","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-12-11 08:59:30","updated":"2025-06-04 09:24:32","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.matthijskamstra.nl\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/\" title=\"Flash\">Flash<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/\" title=\"AS3\">AS3<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHello box2D \u2013 part 2\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.matthijskamstra.nl\/blog"},{"label":"Flash","link":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/"},{"label":"AS3","link":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/"},{"label":"Hello box2D &#8211; part 2","link":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/12\/hello-box2d-part-2\/"}],"_links":{"self":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/comments?post=763"}],"version-history":[{"count":10,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/763\/revisions"}],"predecessor-version":[{"id":807,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/763\/revisions\/807"}],"wp:attachment":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/media?parent=763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/categories?post=763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/tags?post=763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}