<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Intro to Box2D in Flash, Visual Explination UPDATED</title>
	<atom:link href="http://blog.thestem.ca/archives/89/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.thestem.ca/archives/89</link>
	<description>Brett Forsyth's professional work showcase, photos, and ramblings.</description>
	<lastBuildDate>Wed, 30 Nov 2011 21:33:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: irongleet</title>
		<link>http://blog.thestem.ca/archives/89#comment-56218</link>
		<dc:creator>irongleet</dc:creator>
		<pubDate>Sat, 14 Feb 2009 00:49:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-56218</guid>
		<description>That was an intro? :&gt;  I&#039;d like to see more of a traditional one.  I&#039;m sure that info is useful to one who already knows how to at least get something simple up and running with box2d but it was useless to me, a box2d noob looking for an intro to box 2d.</description>
		<content:encoded><![CDATA[<p>That was an intro? :&gt;  I&#8217;d like to see more of a traditional one.  I&#8217;m sure that info is useful to one who already knows how to at least get something simple up and running with box2d but it was useless to me, a box2d noob looking for an intro to box 2d.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brettf</title>
		<link>http://blog.thestem.ca/archives/89#comment-45820</link>
		<dc:creator>Brettf</dc:creator>
		<pubDate>Sat, 02 Aug 2008 19:15:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-45820</guid>
		<description>Yeah i read that a while ago as well. Pixel units haven&#039;t been much of an issue yet. I am thinking I need to dome some form of conversion system because setting things up in meters was messing with my head.</description>
		<content:encoded><![CDATA[<p>Yeah i read that a while ago as well. Pixel units haven&#8217;t been much of an issue yet. I am thinking I need to dome some form of conversion system because setting things up in meters was messing with my head.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Debreuil</title>
		<link>http://blog.thestem.ca/archives/89#comment-45479</link>
		<dc:creator>Robin Debreuil</dc:creator>
		<pubDate>Thu, 31 Jul 2008 16:02:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-45479</guid>
		<description>The engine is optimized for distances of .1 and 10 meters (the sweet spot to avoid floating point rounding issues). There are a few places where they strongly recommend not going to pixels, but I&#039;m sure for just getting started/having fun it isn&#039;t a problem : ).  I assume this is the same in the flash version.

(from the manual:)

&quot;Box2D works with floating point numbers, so some tolerances have to be used to make Box2D perform well. These tolerance have been tuned to work well with meters-kilogram-second (MKS) units. In particular, Box2D has been tuned to work well with moving objects between 0.1 and 10 meters. So this means objects between soup cans and buses in size should work well.&quot;

&quot;Being a 2D physics engine it is tempting to use pixels as your units. Unfortunately this will lead to a poor simulation and possibly weird behavior. An object of length 200 pixels would be seen by Box2D as the size of a 45 story building. Imagine trying to simulate the movement of a high-rise building with an engine that is tuned to simulate ragdolls and barrels. It isn&#039;t pretty.&quot;</description>
		<content:encoded><![CDATA[<p>The engine is optimized for distances of .1 and 10 meters (the sweet spot to avoid floating point rounding issues). There are a few places where they strongly recommend not going to pixels, but I&#8217;m sure for just getting started/having fun it isn&#8217;t a problem : ).  I assume this is the same in the flash version.</p>
<p>(from the manual:)</p>
<p>&#8220;Box2D works with floating point numbers, so some tolerances have to be used to make Box2D perform well. These tolerance have been tuned to work well with meters-kilogram-second (MKS) units. In particular, Box2D has been tuned to work well with moving objects between 0.1 and 10 meters. So this means objects between soup cans and buses in size should work well.&#8221;</p>
<p>&#8220;Being a 2D physics engine it is tempting to use pixels as your units. Unfortunately this will lead to a poor simulation and possibly weird behavior. An object of length 200 pixels would be seen by Box2D as the size of a 45 story building. Imagine trying to simulate the movement of a high-rise building with an engine that is tuned to simulate ragdolls and barrels. It isn&#8217;t pretty.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brettf</title>
		<link>http://blog.thestem.ca/archives/89#comment-39033</link>
		<dc:creator>Brettf</dc:creator>
		<pubDate>Wed, 04 Jun 2008 04:55:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-39033</guid>
		<description>Well Rajan I thank you for your input as you seem to be correct. This is good news as the whole meters thing was starting to bug me.</description>
		<content:encoded><![CDATA[<p>Well Rajan I thank you for your input as you seem to be correct. This is good news as the whole meters thing was starting to bug me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ragaskar</title>
		<link>http://blog.thestem.ca/archives/89#comment-39016</link>
		<dc:creator>ragaskar</dc:creator>
		<pubDate>Wed, 04 Jun 2008 01:20:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-39016</guid>
		<description>Er, sorry, I have trouble being succinct: 

I think if you&#039;re using code from the TestBed or HelloWorld as a base for your examples you are going to see 30-pixel units. I think this is a legacy situation and not something that is built into the engine. I have not seen this for the code I&#039;ve written where all the 30x multipliers have been removed, although it just may be that I haven&#039;t hit that instance yet. I have been very confused by the references to &quot;meters&quot; in the code comments (and the random multipliers in the HelloWorld example), but nothing I&#039;ve seen seems to suggest that they are in anything but pixels.</description>
		<content:encoded><![CDATA[<p>Er, sorry, I have trouble being succinct: </p>
<p>I think if you&#8217;re using code from the TestBed or HelloWorld as a base for your examples you are going to see 30-pixel units. I think this is a legacy situation and not something that is built into the engine. I have not seen this for the code I&#8217;ve written where all the 30x multipliers have been removed, although it just may be that I haven&#8217;t hit that instance yet. I have been very confused by the references to &#8220;meters&#8221; in the code comments (and the random multipliers in the HelloWorld example), but nothing I&#8217;ve seen seems to suggest that they are in anything but pixels.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ragaskar</title>
		<link>http://blog.thestem.ca/archives/89#comment-39015</link>
		<dc:creator>ragaskar</dc:creator>
		<pubDate>Wed, 04 Jun 2008 01:14:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-39015</guid>
		<description>Shoot, i hit post before I was ready. 

In the TestBed Test.as, you have the following line: 


dbgDraw.m_drawScale = 30.0


which again suggests that everything is getting scaled. 

You&#039;ll see that the HelloWorld userData sprite width and height gets multiplied by 30 on lines 71 and 72 of HelloWorld.as

Now, I&#039;m willing to submit that this is because it makes it simpler to work with meter measurements that exist elsewhere in the engine, but my code hasn&#039;t shown this to be true. 

I also just grep-ed the engine source files and found only two mentions of the number 30 -- both in comments, neither in any statements, which again suggests that the Box2D flash version defaults to pixels, or at the least does not have any 30xPixel measurement. Still I&#039;ll admit haven&#039;t done enough digging to see that this is truly the case. I&#039;d love to see a definitive answer on this, though, if there are measurements in Box2D that are taking unusual units, it&#039;d probably save me a lot of frustration if I knew about them.</description>
		<content:encoded><![CDATA[<p>Shoot, i hit post before I was ready. </p>
<p>In the TestBed Test.as, you have the following line: </p>
<p>dbgDraw.m_drawScale = 30.0</p>
<p>which again suggests that everything is getting scaled. </p>
<p>You&#8217;ll see that the HelloWorld userData sprite width and height gets multiplied by 30 on lines 71 and 72 of HelloWorld.as</p>
<p>Now, I&#8217;m willing to submit that this is because it makes it simpler to work with meter measurements that exist elsewhere in the engine, but my code hasn&#8217;t shown this to be true. </p>
<p>I also just grep-ed the engine source files and found only two mentions of the number 30 &#8212; both in comments, neither in any statements, which again suggests that the Box2D flash version defaults to pixels, or at the least does not have any 30xPixel measurement. Still I&#8217;ll admit haven&#8217;t done enough digging to see that this is truly the case. I&#8217;d love to see a definitive answer on this, though, if there are measurements in Box2D that are taking unusual units, it&#8217;d probably save me a lot of frustration if I knew about them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ragaskar</title>
		<link>http://blog.thestem.ca/archives/89#comment-39014</link>
		<dc:creator>ragaskar</dc:creator>
		<pubDate>Wed, 04 Jun 2008 01:05:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-39014</guid>
		<description>I&#039;m using the latest version. 

In the helloWorld update loop you have this happening: 


	bb.m_userData.x = bb.GetPosition().x * 30;
        bb.m_userData.y = bb.GetPosition().y * 30;


which suggests to me that the coords are getting multiplied by a factor of 30. When I did my own loop, I removed the *30 and otherwise kept the stanza the same, and got pixel based units.</description>
		<content:encoded><![CDATA[<p>I&#8217;m using the latest version. </p>
<p>In the helloWorld update loop you have this happening: </p>
<p>	bb.m_userData.x = bb.GetPosition().x * 30;<br />
        bb.m_userData.y = bb.GetPosition().y * 30;</p>
<p>which suggests to me that the coords are getting multiplied by a factor of 30. When I did my own loop, I removed the *30 and otherwise kept the stanza the same, and got pixel based units.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brettf</title>
		<link>http://blog.thestem.ca/archives/89#comment-38990</link>
		<dc:creator>Brettf</dc:creator>
		<pubDate>Tue, 03 Jun 2008 19:54:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-38990</guid>
		<description>Looking through the b2Vec2  class of the Box2DFlash2.0 release nothing is getting set into pixels as far as i can tell. Which version are you using? In my example if you change some of the values you will see objects move by 30px. 

In the helloWorld and Test bed when setting the width and height of userData property its in pixels but everything else is in meters. This is because userData provides access to the actual Sprite or MC in the userData.</description>
		<content:encoded><![CDATA[<p>Looking through the b2Vec2  class of the Box2DFlash2.0 release nothing is getting set into pixels as far as i can tell. Which version are you using? In my example if you change some of the values you will see objects move by 30px. </p>
<p>In the helloWorld and Test bed when setting the width and height of userData property its in pixels but everything else is in meters. This is because userData provides access to the actual Sprite or MC in the userData.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ragaskar</title>
		<link>http://blog.thestem.ca/archives/89#comment-38988</link>
		<dc:creator>ragaskar</dc:creator>
		<pubDate>Tue, 03 Jun 2008 19:31:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-38988</guid>
		<description>From what I&#039;ve seen, Position and SetAsBox all take units in pixels. 

The testbed and helloWorld Sprites are all scaled 30x, for some reason -- is this what you&#039;re thinking of? 

I can&#039;t find confirmation about this (the AS3 Box2D port has pretty limited documentation, as you know), but searching around, I think here&#039;s what might be the situation: 

*Box2D used meters until version 1.4.3, then switched to pixels (might it have switched back? not sure!)
* Instead of rewriting the demo and testbed, the code was modified so it still worked (ie, everything was multiplied by 30). I think this is likely because you can see other places in the demo where old code has simply been commented out as the engine has been updated (for example, it&#039;s clear that the debugDraw stuff used to be done &#039;by hand&#039;, until the engine was able to internalize it -- that code is still in the testbed, just commented out). This would actually explain something that has been confusing me for awhile -- why the demos scale everything by 30! 

If someone knows, please correct me if I&#039;m wrong on this.  Thanks! 

BTW, great info in these blog posts about Box2D! Thanks for taking the time to make them.</description>
		<content:encoded><![CDATA[<p>From what I&#8217;ve seen, Position and SetAsBox all take units in pixels. </p>
<p>The testbed and helloWorld Sprites are all scaled 30x, for some reason &#8212; is this what you&#8217;re thinking of? </p>
<p>I can&#8217;t find confirmation about this (the AS3 Box2D port has pretty limited documentation, as you know), but searching around, I think here&#8217;s what might be the situation: </p>
<p>*Box2D used meters until version 1.4.3, then switched to pixels (might it have switched back? not sure!)<br />
* Instead of rewriting the demo and testbed, the code was modified so it still worked (ie, everything was multiplied by 30). I think this is likely because you can see other places in the demo where old code has simply been commented out as the engine has been updated (for example, it&#8217;s clear that the debugDraw stuff used to be done &#8216;by hand&#8217;, until the engine was able to internalize it &#8212; that code is still in the testbed, just commented out). This would actually explain something that has been confusing me for awhile &#8212; why the demos scale everything by 30! </p>
<p>If someone knows, please correct me if I&#8217;m wrong on this.  Thanks! </p>
<p>BTW, great info in these blog posts about Box2D! Thanks for taking the time to make them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brettf</title>
		<link>http://blog.thestem.ca/archives/89#comment-38872</link>
		<dc:creator>Brettf</dc:creator>
		<pubDate>Mon, 02 Jun 2008 20:21:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thestem.ca/?p=89#comment-38872</guid>
		<description>Probably. The other bit that keeps making me screw up is the centered registration point for everything. Forcing me to think in new ways.</description>
		<content:encoded><![CDATA[<p>Probably. The other bit that keeps making me screw up is the centered registration point for everything. Forcing me to think in new ways.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

