<?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: Using BitmapData.hitTest for Collision Detection</title>
	<atom:link href="http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/</link>
	<description>code = joy</description>
	<lastBuildDate>Fri, 02 Dec 2011 01:36:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: AS3 Pixel Perfect Collision/hittest &#124; Krüger&#039;s Blog</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-26713</link>
		<dc:creator>AS3 Pixel Perfect Collision/hittest &#124; Krüger&#039;s Blog</dc:creator>
		<pubDate>Mon, 30 May 2011 09:22:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-26713</guid>
		<description>[...] Må skynde mig at sige at jeg har stjålet den grundlæggende kode for følgende, herfra. [...]</description>
		<content:encoded><![CDATA[<p>[...] Må skynde mig at sige at jeg har stjålet den grundlæggende kode for følgende, herfra. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hitTestObject nicht auf die Bounding-Box sondern auf Inhalt anwenden? - Flashforum</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-26706</link>
		<dc:creator>hitTestObject nicht auf die Bounding-Box sondern auf Inhalt anwenden? - Flashforum</dc:creator>
		<pubDate>Fri, 27 May 2011 16:15:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-26706</guid>
		<description>[...] du suchst ist BitmapData.hitTest()  Using BitmapData.hitTest for Collision Detection at Mike Chambers  mfg  [...]</description>
		<content:encoded><![CDATA[<p>[...] du suchst ist BitmapData.hitTest()  Using BitmapData.hitTest for Collision Detection at Mike Chambers  mfg  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: help seeker</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-24868</link>
		<dc:creator>help seeker</dc:creator>
		<pubDate>Tue, 18 Jan 2011 09:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-24868</guid>
		<description>Hi, 
I like this piece of code very much but when one of the movieclip&#039;s registration point is changed to center it won&#039;t work perfectly.

I need this code to be updated for regardless of any registration of the movieclip.

I tried a lot of I could not:( 
please can any one help me???
I need my one movieclip in center registration point.

plz plz help!!!</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I like this piece of code very much but when one of the movieclip&#8217;s registration point is changed to center it won&#8217;t work perfectly.</p>
<p>I need this code to be updated for regardless of any registration of the movieclip.</p>
<p>I tried a lot of I could not:(<br />
please can any one help me???<br />
I need my one movieclip in center registration point.</p>
<p>plz plz help!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LoL</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-24764</link>
		<dc:creator>LoL</dc:creator>
		<pubDate>Thu, 04 Nov 2010 11:20:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-24764</guid>
		<description>@Rackdoll

What you can do is to derive a 2D matrix from the 3D matrix by discarding the Z data.

Then you will have an extra step to check for this depth data yourself (when you know that in 2D they collide)

private static function getMatrix(obj:DisplayObject, boundX:Number, boundY:Number):Matrix {
			if (obj.transform.matrix != null)
				return obj.transform.matrix.clone();
				
				
			var objM:Matrix3D = obj.transform.matrix3D;
			var rawMatrixData:Vector. = objM.rawData;
			var matrix:Matrix = new Matrix();
			matrix.a = rawMatrixData[0];
			matrix.c = rawMatrixData[1];
			matrix.tx = obj.x - boundX;
			matrix.b = rawMatrixData[4];
			matrix.d = rawMatrixData[5];
			matrix.ty = obj.y - boundY;
			return matrix;
		}

you pass a DisplayObject and its bounding x and y coordinates.</description>
		<content:encoded><![CDATA[<p>@Rackdoll</p>
<p>What you can do is to derive a 2D matrix from the 3D matrix by discarding the Z data.</p>
<p>Then you will have an extra step to check for this depth data yourself (when you know that in 2D they collide)</p>
<p>private static function getMatrix(obj:DisplayObject, boundX:Number, boundY:Number):Matrix {<br />
			if (obj.transform.matrix != null)<br />
				return obj.transform.matrix.clone();</p>
<p>			var objM:Matrix3D = obj.transform.matrix3D;<br />
			var rawMatrixData:Vector. = objM.rawData;<br />
			var matrix:Matrix = new Matrix();<br />
			matrix.a = rawMatrixData[0];<br />
			matrix.c = rawMatrixData[1];<br />
			matrix.tx = obj.x &#8211; boundX;<br />
			matrix.b = rawMatrixData[4];<br />
			matrix.d = rawMatrixData[5];<br />
			matrix.ty = obj.y &#8211; boundY;<br />
			return matrix;<br />
		}</p>
<p>you pass a DisplayObject and its bounding x and y coordinates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AdyR</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-24751</link>
		<dc:creator>AdyR</dc:creator>
		<pubDate>Sat, 30 Oct 2010 15:18:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-24751</guid>
		<description>Great article! it really helped me.

To give something back I&#039;m going to explain how I solved this problem if, for example, the redClip has a parent different than &quot;this&quot;.

First we get it&#039;s position relative to &quot;this&quot;:
var pRedPosition:Point = new Point(redClip.x, redClip.y);
pRedPosition= redClip.parent.localToGlobal(pRedPosition);
pRedPosition= this.globalToLocal(pRedPosition);


Than we replace these lines:
redOffset.tx = redClip.x - redRect.x;
redOffset.ty = redClip.y - redRect.y;
with:
redOffset.tx = pRedPosition.x - redRect.x;
redOffset.ty = pRedPosition.y - redRect.y;

If blueClip has a different parent than &quot;this&quot; too we do something similar.</description>
		<content:encoded><![CDATA[<p>Great article! it really helped me.</p>
<p>To give something back I&#8217;m going to explain how I solved this problem if, for example, the redClip has a parent different than &#8220;this&#8221;.</p>
<p>First we get it&#8217;s position relative to &#8220;this&#8221;:<br />
var pRedPosition:Point = new Point(redClip.x, redClip.y);<br />
pRedPosition= redClip.parent.localToGlobal(pRedPosition);<br />
pRedPosition= this.globalToLocal(pRedPosition);</p>
<p>Than we replace these lines:<br />
redOffset.tx = redClip.x &#8211; redRect.x;<br />
redOffset.ty = redClip.y &#8211; redRect.y;<br />
with:<br />
redOffset.tx = pRedPosition.x &#8211; redRect.x;<br />
redOffset.ty = pRedPosition.y &#8211; redRect.y;</p>
<p>If blueClip has a different parent than &#8220;this&#8221; too we do something similar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rackdoll</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-23901</link>
		<dc:creator>Rackdoll</dc:creator>
		<pubDate>Mon, 30 Aug 2010 12:18:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-23901</guid>
		<description>BitmapData.hittest still breaks when applying a rotation over a specific axis. Especially the X &amp; Y.
the transform.matrix will be removed and a transform.matrix3D will be created.....
Any fix for this ?</description>
		<content:encoded><![CDATA[<p>BitmapData.hittest still breaks when applying a rotation over a specific axis. Especially the X &amp; Y.<br />
the transform.matrix will be removed and a transform.matrix3D will be created&#8230;..<br />
Any fix for this ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pixel perfect hit detection in Actionscript 3 &#124; Engine Digital Inc. / Blog</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-22801</link>
		<dc:creator>Pixel perfect hit detection in Actionscript 3 &#124; Engine Digital Inc. / Blog</dc:creator>
		<pubDate>Mon, 14 Jun 2010 19:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-22801</guid>
		<description>[...] This code was adapted from a post by Mike Chambers [...]</description>
		<content:encoded><![CDATA[<p>[...] This code was adapted from a post by Mike Chambers [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-21690</link>
		<dc:creator>David</dc:creator>
		<pubDate>Sat, 08 May 2010 16:51:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-21690</guid>
		<description>I can&#039;t seem to get the first example working... 

I&#039;ve made the 2 movie Clips, Using PolyStar and Oval Tools, But I can&#039;t seem to get them working

Erro 1046: Type was not found or was not a compile-time constant: redClip and same for blueClip :(</description>
		<content:encoded><![CDATA[<p>I can&#8217;t seem to get the first example working&#8230; </p>
<p>I&#8217;ve made the 2 movie Clips, Using PolyStar and Oval Tools, But I can&#8217;t seem to get them working</p>
<p>Erro 1046: Type was not found or was not a compile-time constant: redClip and same for blueClip :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: northmantif</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-18926</link>
		<dc:creator>northmantif</dc:creator>
		<pubDate>Wed, 17 Mar 2010 14:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-18926</guid>
		<description>after few days lookin for right approach to object with scale and rotation involved with hitTestObject issue, i am full of respect for the author of this piece of code.
On hundreds of sites i can find how to make accurate hitTest against static objects, but only here with so small piece of code i found totally amazing and fast workaround. Great stuff! Thank you.</description>
		<content:encoded><![CDATA[<p>after few days lookin for right approach to object with scale and rotation involved with hitTestObject issue, i am full of respect for the author of this piece of code.<br />
On hundreds of sites i can find how to make accurate hitTest against static objects, but only here with so small piece of code i found totally amazing and fast workaround. Great stuff! Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anon</title>
		<link>http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/comment-page-1/#comment-18465</link>
		<dc:creator>anon</dc:creator>
		<pubDate>Mon, 15 Feb 2010 21:32:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1745#comment-18465</guid>
		<description>What if the two movieclips you wish to compare are composed of many nested clips, all of which could be at any arbitrary x/y value and any arbitrary scale?  It seems like the matrix transformation trick works if only the first layer is off center or rotated, but if the clip is many layers deep and the transformations are completely random for each layer, it&#039;s not working.

For instance, what if blueClip were like this:

blueClip x=20, y=50
 + blueClipChild x = 400, y = -20
   + blueClipChildChild x = -1309, y = 20
     + Shape (square, 30px/300px at x = 10, y = -280)

How would you solve for this?</description>
		<content:encoded><![CDATA[<p>What if the two movieclips you wish to compare are composed of many nested clips, all of which could be at any arbitrary x/y value and any arbitrary scale?  It seems like the matrix transformation trick works if only the first layer is off center or rotated, but if the clip is many layers deep and the transformations are completely random for each layer, it&#8217;s not working.</p>
<p>For instance, what if blueClip were like this:</p>
<p>blueClip x=20, y=50<br />
 + blueClipChild x = 400, y = -20<br />
   + blueClipChildChild x = -1309, y = 20<br />
     + Shape (square, 30px/300px at x = 10, y = -280)</p>
<p>How would you solve for this?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

