<?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: Managing ball vs ball collision with Flash</title>
	<atom:link href="http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/</link>
	<description>italian geek and PROgrammer</description>
	<lastBuildDate>Fri, 10 Feb 2012 12:12:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: Josh</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-970341</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Wed, 19 Oct 2011 03:31:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-970341</guid>
		<description>This was super helpful. I was also running into issues with the balls sticking together, especially since I&#039;m working on an asteroids clone.

I decided the best solution is that after the balls have collided, do all the collision calculations and then move them so that they will be just outside the area where they collided, along the collision vector. My variables are a little differently named, but the principle is the same:

This would go between the equivalent of line 61 and 62 above, where minDist = the sum of the radii and rockDist = the distance between centerpoints.

var rockOffset = minDist - rockDist;
RockB.rock.x -= Math.cos(collisionAngle)*rockOffset;
RockB.rock.y -= Math.sin(collisionAngle)*rockOffset;</description>
		<content:encoded><![CDATA[<p>This was super helpful. I was also running into issues with the balls sticking together, especially since I&#8217;m working on an asteroids clone.</p>
<p>I decided the best solution is that after the balls have collided, do all the collision calculations and then move them so that they will be just outside the area where they collided, along the collision vector. My variables are a little differently named, but the principle is the same:</p>
<p>This would go between the equivalent of line 61 and 62 above, where minDist = the sum of the radii and rockDist = the distance between centerpoints.</p>
<p>var rockOffset = minDist &#8211; rockDist;<br />
RockB.rock.x -= Math.cos(collisionAngle)*rockOffset;<br />
RockB.rock.y -= Math.sin(collisionAngle)*rockOffset;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CoProgrammer</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-957687</link>
		<dc:creator>CoProgrammer</dc:creator>
		<pubDate>Wed, 05 Oct 2011 18:41:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-957687</guid>
		<description>Thanks! This is a very good website for tutorials and I have enjoyed learning some Physics as well! I am currently trying to create a Brick-Breaker game. I will hopefully create a tutorial about that later.

To extend the code add:

this.removeMovieClip(ball);

Or for the bowling game:

ball.xspeed = 0
ball.yspeed = 0

on(release){
   ball.xspeed = speed_limit
   ball.yspeed = speed_limit
}</description>
		<content:encoded><![CDATA[<p>Thanks! This is a very good website for tutorials and I have enjoyed learning some Physics as well! I am currently trying to create a Brick-Breaker game. I will hopefully create a tutorial about that later.</p>
<p>To extend the code add:</p>
<p>this.removeMovieClip(ball);</p>
<p>Or for the bowling game:</p>
<p>ball.xspeed = 0<br />
ball.yspeed = 0</p>
<p>on(release){<br />
   ball.xspeed = speed_limit<br />
   ball.yspeed = speed_limit<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CoProgrammer</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-957685</link>
		<dc:creator>CoProgrammer</dc:creator>
		<pubDate>Wed, 05 Oct 2011 18:39:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-957685</guid>
		<description>Thanks! This is a very good website for tutorials and I have enjoyed learning some Physics as well! I am currently trying to create a Brick-Breaker game. I will hopefully create a tutorial about that later.</description>
		<content:encoded><![CDATA[<p>Thanks! This is a very good website for tutorials and I have enjoyed learning some Physics as well! I am currently trying to create a Brick-Breaker game. I will hopefully create a tutorial about that later.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: answertotony</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-957680</link>
		<dc:creator>answertotony</dc:creator>
		<pubDate>Wed, 05 Oct 2011 18:36:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-957680</guid>
		<description>@Tony:

Easy!

this.removeMovieClip(ball);</description>
		<content:encoded><![CDATA[<p>@Tony:</p>
<p>Easy!</p>
<p>this.removeMovieClip(ball);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jutvar</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-893170</link>
		<dc:creator>Jutvar</dc:creator>
		<pubDate>Mon, 01 Aug 2011 19:43:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-893170</guid>
		<description>I only will say THANKS ! 5/5</description>
		<content:encoded><![CDATA[<p>I only will say THANKS ! 5/5</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodrigo</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-862748</link>
		<dc:creator>Rodrigo</dc:creator>
		<pubDate>Mon, 27 Jun 2011 18:24:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-862748</guid>
		<description>Hello! very nice tutorial, gratz! just what i wanted.

Actually i need one more thing, when you click on a ball, it duplicate in 2...
its possible?

thanks</description>
		<content:encoded><![CDATA[<p>Hello! very nice tutorial, gratz! just what i wanted.</p>
<p>Actually i need one more thing, when you click on a ball, it duplicate in 2&#8230;<br />
its possible?</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinh</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-710834</link>
		<dc:creator>Vinh</dc:creator>
		<pubDate>Fri, 24 Dec 2010 04:01:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-710834</guid>
		<description>sorry, my bad. You solved it already :D</description>
		<content:encoded><![CDATA[<p>sorry, my bad. You solved it already :D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinh</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-710829</link>
		<dc:creator>Vinh</dc:creator>
		<pubDate>Fri, 24 Dec 2010 03:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-710829</guid>
		<description>I found a bug: two circle collided and it was sticked together.

I&#039;m finding the reason and try to fix it.

Anyway, this is cool tutorial that is exactly what I want.

Thanks Emanuele so much.</description>
		<content:encoded><![CDATA[<p>I found a bug: two circle collided and it was sticked together.</p>
<p>I&#8217;m finding the reason and try to fix it.</p>
<p>Anyway, this is cool tutorial that is exactly what I want.</p>
<p>Thanks Emanuele so much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-644554</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Wed, 22 Sep 2010 20:05:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-644554</guid>
		<description>I&#039;m not too good at programming (or physics) but I would agree that the y-velocities would also need to be updated.

So, are we saying that instead of:

	final_yspeed_1 = new_yspeed_1;
	final_yspeed_2 = new_yspeed_2;


we need to put something else?  Can anybody provide that?  Pandora, I appreciate all the code you provided but I was working through the earlier code and I am finding it difficult to match up your variables names with the original.   Could anybody update the original code please?

Thanking you in advance

Si</description>
		<content:encoded><![CDATA[<p>I&#8217;m not too good at programming (or physics) but I would agree that the y-velocities would also need to be updated.</p>
<p>So, are we saying that instead of:</p>
<p>	final_yspeed_1 = new_yspeed_1;<br />
	final_yspeed_2 = new_yspeed_2;</p>
<p>we need to put something else?  Can anybody provide that?  Pandora, I appreciate all the code you provided but I was working through the earlier code and I am finding it difficult to match up your variables names with the original.   Could anybody update the original code please?</p>
<p>Thanking you in advance</p>
<p>Si</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kawika</title>
		<link>http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-636106</link>
		<dc:creator>Kawika</dc:creator>
		<pubDate>Wed, 08 Sep 2010 05:16:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/#comment-636106</guid>
		<description>Thanks!  This post is helping with my physics research for a game I&#039;m writing!</description>
		<content:encoded><![CDATA[<p>Thanks!  This post is helping with my physics research for a game I&#8217;m writing!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 6/11 queries in 0.007 seconds using disk: basic

Served from: www.emanueleferonato.com @ 2012-02-11 06:42:18 -->
