<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<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">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: detection - Recent Posts</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/detection</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Sat, 31 Jul 2010 07:43:42 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/detection" rel="self" type="application/rss+xml" />

		<item>
			<title>Quartermaine on "Using Box2d just for collision detection(no physics)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2692/page/2#post-45065</link>
			<pubDate>Wed, 07 Jul 2010 08:15:20 +0000</pubDate>
			<dc:creator>Quartermaine</dc:creator>
			<guid isPermaLink="false">45065@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;@&#60;a href='http://www.cocos2d-iphone.org/forum/profile/1700'&#62;Lam&#60;/a&#62;, thank you very much.  That code showed me exactly how to do what I wanted.  I wasn't able to get your draw method to work in my own project, because it builds the vertices for the box assuming it isn't rotated, which is what I needed the collision detection for :)&#60;/p&#62;
&#60;p&#62;Awesome stuff!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Lam on "Using Box2d just for collision detection(no physics)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2692/page/2#post-44987</link>
			<pubDate>Tue, 06 Jul 2010 20:50:18 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">44987@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hopefully my dropbox link will always be active. :D&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://dl.dropbox.com/u/271717/SimpleShapeDetection.zip&#34; rel=&#34;nofollow&#34;&#62;http://dl.dropbox.com/u/271717/SimpleShapeDetection.zip&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Unfortunately I tend to get quite busy and it's hard to keep up with the forums. If anyone ever has questions then I generally respond as quickly as I can if you PM me otherwise a post may take weeks/months for me to actually  notice =/&#60;/p&#62;
&#60;p&#62;I'll let you take a look at the source first and if any problems do pop up (maybe box2d's changed) then I'll see what I can do to help.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Quartermaine on "Using Box2d just for collision detection(no physics)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2692/page/2#post-44983</link>
			<pubDate>Tue, 06 Jul 2010 20:19:03 +0000</pubDate>
			<dc:creator>Quartermaine</dc:creator>
			<guid isPermaLink="false">44983@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;@&#60;a href='http://www.cocos2d-iphone.org/forum/profile/1700'&#62;Lam&#60;/a&#62;&#60;br /&#62;
Can you please re-upload your sample to mediafire?  The link is no longer active.  I'd really like to see it.&#60;/p&#62;
&#60;p&#62;I'm trying to check if rotated rectangles are in contact, and I've used most of your code, but I think there is a problem with the way I've got the code written.  Here is what I have in the init of my HelloWorldScene.mm:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;//Set up sprites
		CCSprite *SpriteA = [CCSprite spriteWithFile:@&#38;quot;icon.png&#38;quot;]; //assume icon is 60X60
		[self addChild:SpriteA];
		[SpriteA setPosition:ccp(40.0f, 100.0f)];

		CCSprite *SpriteB = [CCSprite spriteWithFile:@&#38;quot;icon.png&#38;quot;];
		[self addChild:SpriteB];
		[SpriteB setPosition:ccp(300.0f, 100.0f)];
		[SpriteB setRotation:45.0f];

		b2Manifold manifold;
		b2PolygonShape A,B;

		//... store the width.height with setBox for the shape region
		A.SetAsBox(60.0f*PTM_RATIO,60.0f*PTM_RATIO);
		B.SetAsBox(60.0f*PTM_RATIO,60.0f*PTM_RATIO);

		//... store the position location and angle of shape A and B into transform with Set.
		b2Transform transA, transB;
		transA.Set(b2Vec2(40.0f*PTM_RATIO, 100.0f*PTM_RATIO),0.0f);
		transB.Set(b2Vec2(200.0f*PTM_RATIO, 100.0f*PTM_RATIO),0.7853f); //0.7853f = 45 degrees

		b2CollidePolygons(&#38;amp;manifold, &#38;amp;A, transA, &#38;amp;B, transB);
		if(manifold.pointCount &#38;gt; 0){
			NSLog(@&#38;quot;collided&#38;quot;);
		}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;In your code you suggested looking at manifold.m_pointCount, but that threw an error.  i did find a pointCount, but before calling b2CollidePolygons, the value is 100480, and afterwards it is 2, no matter what I set my box and transform values to...&#60;/p&#62;
&#60;p&#62;Any suggestions what I am doing wrong?&#60;/p&#62;
&#60;p&#62;Cheers!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bradparks on "Collision detection performance problems with tiledmap"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7173#post-42143</link>
			<pubDate>Fri, 18 Jun 2010 02:16:22 +0000</pubDate>
			<dc:creator>bradparks</dc:creator>
			<guid isPermaLink="false">42143@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;hmmm.... i just took a look, and I think that means that the grid is square... so whatever you pass in for grid size will be used as the number of cols AND the number of rows... &#60;/p&#62;
&#60;p&#62;then I think you'd call getRoughRange or getExactRange to return the objects that were in those areas... I think that &#34;x&#34; and &#34;y&#34; are the position you want to check, and &#34;range&#34; is possibly the number of cells you want to check around the char, in a square.... but.... it's a guess! the code was donated by @&#60;a href='http://www.cocos2d-iphone.org/forum/profile/47'&#62;slipster216&#60;/a&#62;, I think, so maybe he'll be able to pipe in!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>MrMojo on "I&#039;ve searched - but how to check for collision with rotated CGRect?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7150#post-42140</link>
			<pubDate>Fri, 18 Jun 2010 02:02:42 +0000</pubDate>
			<dc:creator>MrMojo</dc:creator>
			<guid isPermaLink="false">42140@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;thanks for all the suggestions! i got something working using both the original concept (CGPointApplyAffineTransform) and the concept posted by @&#60;a href='http://www.cocos2d-iphone.org/forum/profile/626'&#62;mobilebros&#60;/a&#62;. I have all of the following methods on my sprite class, but it may work at a higher level too (CCNode?). Thanks again for all your pointers! the code below is still ignoring the anchor point though, and I do believe could be easily extended to include scaling,etc using the transform approach, now that I have rotation working.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// Supporting method. Returns a rect that represents the top left corner of a node, and it&#38;#39;s width and height. Anchor Point ignored.
-(CGRect) getExtentsRect
{
	CGRect rectBounds = CGRectMake(self.position.x-(self.contentSize.width*0.5f), self.position.y-(self.contentSize.width*0.5f), self.contentSize.width, self.contentSize.height);
	return rectBounds;
}	

// Rotates a point (targetPt) about another point (anchorPt) by an angle (degrees) using a transform
-(CGPoint) rotatePointAboutPoint:(CGPoint) targetPt anchorPt:(CGPoint) anchorPt angle:(float) angle
{
	CGRect rectExtents = [self getExtentsRect];

	CGPoint targetPtRelativeToSelf = ccpSub(targetPt, anchorPt);
	CGPoint RotatedPt = CGPointApplyAffineTransform(targetPtRelativeToSelf, CGAffineTransformMakeRotation(-CC_DEGREES_TO_RADIANS(angle)));
	RotatedPt = ccpAdd(self.position, RotatedPt);

	return RotatedPt;
}

// SOLUTION 1: Returns whether or not a point intersects another point using CGPointApplyAffineTransform.
-(BOOL) intersectsPointUsingTransform:(CGPoint) pt
{
	CGRect extentsRect = [self getExtentsRect];
	CGPoint rotatedPt = [self rotatePointAboutPoint:pt anchorPt:self.position angle:self.rotation];
	return CGRectContainsPoint(extentsRect, rotatedPt);
}

// SOLUTION 2: Returns whether or not a point intersects another point using basic trig.
-(BOOL) intersectsPointUsingTrig: (CGPoint) pt
{
	CGRect rectExtents = [self getExtentsRect];
	CGPoint rotatedPt = ccpRotateByAngle(pt, self.position, -CC_DEGREES_TO_RADIANS(self.rotation));
	return CGRectContainsPoint(rectExtents, rotatedPt);
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>ldaume on "Collision detection performance problems with tiledmap"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7173#post-42119</link>
			<pubDate>Thu, 17 Jun 2010 23:33:17 +0000</pubDate>
			<dc:creator>ldaume</dc:creator>
			<guid isPermaLink="false">42119@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I'd love to try it with the proximity manager but not really sure how.&#60;/p&#62;
&#60;p&#62;Can I just add the rects array of my obstacles and if yes, how? Or exists any example out there?&#60;br /&#62;
Another thing is the create method. I thought that a grid need x and y values and not just one uint. Is background.tiles (CCTMXLayer) the right value?&#60;/p&#62;
&#60;p&#62;Otherwise I give box2d a try.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>steg90 on "Collision detection performance problems with tiledmap"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7173#post-42106</link>
			<pubDate>Thu, 17 Jun 2010 21:07:14 +0000</pubDate>
			<dc:creator>steg90</dc:creator>
			<guid isPermaLink="false">42106@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I'd take a look at implementing a quad tree, this would speed up the collision checking no end.  I've used them when doing terrain engines on the *cough *cough PC with Direct3D.&#60;/p&#62;
&#60;p&#62;Regards,&#60;br /&#62;
Steve
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mobilebros on "I&#039;ve searched - but how to check for collision with rotated CGRect?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7150#post-42102</link>
			<pubDate>Thu, 17 Jun 2010 20:45:32 +0000</pubDate>
			<dc:creator>mobilebros</dc:creator>
			<guid isPermaLink="false">42102@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Given that position is the position of the Rect and width and height are the dimensions, and rotation is the rotation in degrees.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;cpVect centerpt = cpvadd(position, cpv(width*0.5f, height*0.5f));

pt = cpvadd(centerpt, cpvrotate(cpvsub(pt, centerpt), cpvforangle(-CC_DEGREES_TO_RADIANS(rotation))));

BOOL contains = CGRectContainsPoint(CGRectMake(position.x, position.y, width, height), pt);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I use cpVect functions, but they should map easily to CGPoint functions. So all I do here is rotate the point around the center of the rectangle to match the rotated coord system of the rect.&#60;/p&#62;
&#60;p&#62;Note: Probably using anchorPoint instead of a hard-coded (0.5f, 0.5f) would be better.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bradparks on "Collision detection performance problems with tiledmap"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7173#post-42085</link>
			<pubDate>Thu, 17 Jun 2010 18:09:32 +0000</pubDate>
			<dc:creator>bradparks</dc:creator>
			<guid isPermaLink="false">42085@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;also, on ray's site, there's an article that implements collision detection with TileMaps.... but it does it by looking at the tiles themselves, not at Objects/Bounding Boxes layers.... so this might not fit for you.... still might be of interest....&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.raywenderlich.com/1186/collisions-and-collectables-how-to-make-a-tile-based-game-with-cocos2d-part-2&#34; rel=&#34;nofollow&#34;&#62;http://www.raywenderlich.com/1186/collisions-and-collectables-how-to-make-a-tile-based-game-with-cocos2d-part-2&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Dunc on "I&#039;ve searched - but how to check for collision with rotated CGRect?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7150#post-42082</link>
			<pubDate>Thu, 17 Jun 2010 17:51:34 +0000</pubDate>
			<dc:creator>Dunc</dc:creator>
			<guid isPermaLink="false">42082@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Ray Wenderleich posted a nice tutorial a while back which shows how you can use box2d as a convenient approach to collision detection.  Not sure if it'll be overkill for what you are trying to achieve, but here it is just in case: &#60;a href=&#34;http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone&#34; rel=&#34;nofollow&#34;&#62;http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Codemattic on "I&#039;ve searched - but how to check for collision with rotated CGRect?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7150#post-42081</link>
			<pubDate>Thu, 17 Jun 2010 17:43:00 +0000</pubDate>
			<dc:creator>Codemattic</dc:creator>
			<guid isPermaLink="false">42081@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I think Solution 3 would work best:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://local.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/&#34; rel=&#34;nofollow&#34;&#62;http://local.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bradparks on "Collision detection performance problems with tiledmap"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7173#post-42069</link>
			<pubDate>Thu, 17 Jun 2010 16:16:19 +0000</pubDate>
			<dc:creator>bradparks</dc:creator>
			<guid isPermaLink="false">42069@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;basic idea seems ok.... it appears your only testing against stationary objects, right? If not, separate your moving objects into one array, and your stationary into another, and for the stationary objects you could use the the proximity manager that's in the &#34;extras&#34; directory that comes with Cocos2d.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://github.com/cocos2d/cocos2d-iphone/tree/master/extras/proximity/&#34; rel=&#34;nofollow&#34;&#62;http://github.com/cocos2d/cocos2d-iphone/tree/master/extras/proximity/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;i haven't used it, but the idea is that it breaks your level up into a somewhat large grid... and the proximity manager narrows down your tests to test only against the items that are in the same grid element as your player....&#60;/p&#62;
&#60;p&#62;other than that, you could used Box2d just for collision detection, as detailed in this post by Ray Wenderlich:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone&#34; rel=&#34;nofollow&#34;&#62;http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ldaume on "Collision detection performance problems with tiledmap"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7173#post-42062</link>
			<pubDate>Thu, 17 Jun 2010 15:48:33 +0000</pubDate>
			<dc:creator>ldaume</dc:creator>
			<guid isPermaLink="false">42062@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I need an exact collision detection and I tried something thats too heavy for the touch 2g :P.&#60;/p&#62;
&#60;p&#62;I draw objects as bounding boxes around the obstacles with Tiled and as name I use &#34;Obstacle&#34;.&#60;/p&#62;
&#60;p&#62;So in my implemetation I make an array of CGRect's wich I get from the tmx.&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;obstacles = [[NSMutableArray alloc] init];
for (NSDictionary *dict in [objects objects]) {
  if ([[dict valueForKey:@&#38;quot;name&#38;quot;] isEqualToString:@&#38;quot;Obstacle&#38;quot;]) {
    CGRect rect = CGRectMake([[dict valueForKey:@&#38;quot;x&#38;quot;] intValue],
                                                     [[dict valueForKey:@&#38;quot;y&#38;quot;] intValue],
                                                     [[dict valueForKey:@&#38;quot;width&#38;quot;] intValue],
                                                     [[dict valueForKey:@&#38;quot;height&#38;quot;] intValue]);
    [obstacles addObject:[NSValue valueWithCGRect:rect]];
  }
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;And every frame I check if the CGRect of the player intersect one of the obstacles.&#60;br /&#62;
In code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;CGRect playerRect = CGRectMake(player.position.x-playerWidth/2, player.position.y-playerHeight/2, playerWidth, playerHeight);
  for (NSValue *rect in obstacles) {
    if (CGRectIntersectsRect([rect CGRectValue], playerRect)) {
      collided = YES;
    }
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Some hints?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>MrMojo on "I&#039;ve searched - but how to check for collision with rotated CGRect?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7150#post-42019</link>
			<pubDate>Thu, 17 Jun 2010 11:20:55 +0000</pubDate>
			<dc:creator>MrMojo</dc:creator>
			<guid isPermaLink="false">42019@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Note that I also tried using the &#34;boundingBox&#34; as the rotated rect, but that's identical to the &#34;realContentRect&#34; mentioned above, so it doesn't seem to make a difference. any ideas on why this doesn't let me detect a touch in a rotated sprite?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>MrMojo on "I&#039;ve searched - but how to check for collision with rotated CGRect?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7150#post-41971</link>
			<pubDate>Thu, 17 Jun 2010 02:27:09 +0000</pubDate>
			<dc:creator>MrMojo</dc:creator>
			<guid isPermaLink="false">41971@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi there - I've searched the forums, and found the a few posts talking about how to test if a rotated sprite collides with a cgrect, but have tried the solutions posted and got no results ;-(&#60;/p&#62;
&#60;p&#62;e.g.&#60;br /&#62;
&#60;a href=&#34;http://www.cocos2d-iphone.org/forum/topic/1693#post-10649&#34; rel=&#34;nofollow&#34;&#62;http://www.cocos2d-iphone.org/forum/topic/1693#post-10649&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;What I want to do is test if a ROTATED sprite collides with a touched location, but it doesn't seem to work - it still sees the sprite as not rotated when I do my collision test. I've added the following to my sprite class as suggested by most of the approaches i saw:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;-(CGRect) realContentRect
{
  CGRect rect = CGRectMake(0, 0, contentSize_.width, contentSize_.height);
  return CGRectApplyAffineTransform(rect, [self nodeToParentTransform]);
}

-(BOOL) intersectsRect:(CGRect) targetRect
{
  return CGRectIntersectsRect([self realContentRect], targetRect);
}

-(BOOL) intersectsPt:(CGPoint) targetPt
{
  CGRect targetRect = CGRectMake(targetPt.x, targetPt.y, 1, 1);
  return [self intersectsRect:targetRect];
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;and my touchesEnded event tests for collision with my rotated player like so:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;-(void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
	UITouch *touch = [touches anyObject];
	CGPoint location = [touch locationInView:[touch view]];
	location = [[CCDirector sharedDirector] convertToGL:location];

	if ([player intersectsPoint:location])
	{
		NSLog(@&#38;quot;clicked on rotated player&#38;quot;);
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;any ideas why this doesnt work? it works as if the player sprite isn't rotated. thanks so much for any pointers!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Nyvaken on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40243</link>
			<pubDate>Sat, 05 Jun 2010 09:47:12 +0000</pubDate>
			<dc:creator>Nyvaken</dc:creator>
			<guid isPermaLink="false">40243@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Awesome, you guys have been very helpful!! Thanks a lot :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mobilebros on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40144</link>
			<pubDate>Fri, 04 Jun 2010 18:30:45 +0000</pubDate>
			<dc:creator>mobilebros</dc:creator>
			<guid isPermaLink="false">40144@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;In case you do go the SpaceManager route, here's a lil blog post from this site discussing a quick example.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.cocos2d-iphone.org/archives/677&#34; rel=&#34;nofollow&#34;&#62;http://www.cocos2d-iphone.org/archives/677&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bradparks on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40138</link>
			<pubDate>Fri, 04 Jun 2010 16:54:27 +0000</pubDate>
			<dc:creator>bradparks</dc:creator>
			<guid isPermaLink="false">40138@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;seems like you've picked chipmunk... did you take a look at Spacemanager? it's a very very nice wrapper around chipmunk that makes it way easier to setup/manage, IMHO with Objective C / Cocos2d specific functionality... it's managed by @&#60;a href='http://www.cocos2d-iphone.org/forum/profile/626'&#62;mobilebros&#60;/a&#62; that's constantly on these forums too...&#60;/p&#62;
&#60;p&#62;basically, since your still early in your integration efforts, i'd suggest checking it out, big time!&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://code.google.com/p/chipmunk-spacemanager/&#34; rel=&#34;nofollow&#34;&#62;http://code.google.com/p/chipmunk-spacemanager/&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Nyvaken on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40133</link>
			<pubDate>Fri, 04 Jun 2010 16:10:12 +0000</pubDate>
			<dc:creator>Nyvaken</dc:creator>
			<guid isPermaLink="false">40133@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I have now successfully changed my project to a Chipmunk project. Everything works as usual and i've been eyeing some Chipmunk code now for an hour.&#60;/p&#62;
&#60;p&#62;As I understand it, I have to make 3 things for every object: A sprite, a body and a shape. Is this correct? &#60;/p&#62;
&#60;p&#62;I also assume that the static void eachShape(void *ptr, void* unused) method is what I will have to work with the most. Im having trouble using my own variables inside this method. It says they are undeclared.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>liquidfire on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40132</link>
			<pubDate>Fri, 04 Jun 2010 16:07:10 +0000</pubDate>
			<dc:creator>liquidfire</dc:creator>
			<guid isPermaLink="false">40132@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;@&#60;a href='http://www.cocos2d-iphone.org/forum/profile/12652'&#62;Nyvaken&#60;/a&#62; Oops I probably should have read your post better. &#60;/p&#62;
&#60;p&#62;Like I and others have said, it basically comes down to C versus C++. Robo is right, Box2D is more mature and has more examples though. &#60;/p&#62;
&#60;p&#62;I still would advise looking into SpaceManager though.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JonKean on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40131</link>
			<pubDate>Fri, 04 Jun 2010 15:41:58 +0000</pubDate>
			<dc:creator>JonKean</dc:creator>
			<guid isPermaLink="false">40131@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I'm a fan of Chipmunk, but mostly because I'd much rather deal with C than C++.  I agree that you should check out both, play the their sample code, and go with the one that feels the most intuitive to you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Nyvaken on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40125</link>
			<pubDate>Fri, 04 Jun 2010 15:05:06 +0000</pubDate>
			<dc:creator>Nyvaken</dc:creator>
			<guid isPermaLink="false">40125@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Thanks Robodude,&#60;/p&#62;
&#60;p&#62;I will google them both, try some example and see which of them fits my project best.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Nyvaken on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40124</link>
			<pubDate>Fri, 04 Jun 2010 15:02:39 +0000</pubDate>
			<dc:creator>Nyvaken</dc:creator>
			<guid isPermaLink="false">40124@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;That's not my game, it's just a similar game, as I mentioned before :P&#60;/p&#62;
&#60;p&#62;Thanks for the tip! I will look into Chipmunk because I'm not familiar with c++.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>robodude666 on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40123</link>
			<pubDate>Fri, 04 Jun 2010 15:01:08 +0000</pubDate>
			<dc:creator>robodude666</dc:creator>
			<guid isPermaLink="false">40123@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;It's a hard choice. Anyone who uses Box2D will say it's better whilst people who use Chipmunk will say it's better.&#60;/p&#62;
&#60;p&#62;I think it ultimately comes down to which you like more. The &#34;liking&#34; can come in many different forms, from the languages they are both based on to functionality found within.&#60;/p&#62;
&#60;p&#62;Personally, I like Box2D.&#60;/p&#62;
&#60;p&#62;I find it to be a more established engine. It has a larger community, and thusly it's easier to find support and examples for. It's also based on C++, versus Chipmunk being based in C. I like C++ more and find it easier to work with in some cases. You can get screwed over with memory allocation easily, but if you take care of your code you'll be fine. Another major influence is that I really don't like the way Chipmunk's code looks. The &#34;cp&#34; prefix throws me off, and the code itself doesn't look that beautiful. While Box2D takes time to get used to, as it definitely is confusing, it's easy to work with after some experience.&#60;/p&#62;
&#60;p&#62;Then again, I'm a Box2D guy... So everything I said is biased. I'm sure a Chipmunk fan can walk in and disagree with everything I've said.&#60;/p&#62;
&#60;p&#62;Again, it ultimately comes down to what YOU like. Try both. Create example projects for both engines, look through the test and example files. Search for tutorials: Which engine has blogs/articles that might be able to help you out the most? Try to see yourself typing that code out yourself: Is it comfortable? Can you invision yourself writing that from scratch?&#60;/p&#62;
&#60;p&#62;Just play around, and you'll find the engine that's right for you.&#60;/p&#62;
&#60;p&#62;-robodude666
&#60;/p&#62;</description>
		</item>
		<item>
			<title>liquidfire on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40122</link>
			<pubDate>Fri, 04 Jun 2010 14:57:37 +0000</pubDate>
			<dc:creator>liquidfire</dc:creator>
			<guid isPermaLink="false">40122@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Personally, I like Chipmunk because it is written in C, which I am most familiar with. It also has a good wrapper called &#60;a href=&#34;http://code.google.com/p/chipmunk-spacemanager/&#34;&#62;SpaceManager&#60;/a&#62;.&#60;/p&#62;
&#60;p&#62;The good parts of Box2D are that it supports bullets better, but in your preview it doesn't seem like you have any super fast bullets travelling. Box2D is written in C++ so if you like that language better, it may be easier.&#60;/p&#62;
&#60;p&#62;Your game looks AMAZING though. The sounds, interface, graphics, gameplay, it all looks amazing. Quite honestly I see it in the top 10.&#60;/p&#62;
&#60;p&#62;How did you achieve the smooth scrolling around the map?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Nyvaken on "Should I go chipmunk or Box2D?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6841#post-40119</link>
			<pubDate>Fri, 04 Jun 2010 14:33:47 +0000</pubDate>
			<dc:creator>Nyvaken</dc:creator>
			<guid isPermaLink="false">40119@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi, I'm working on a tank game where the player views and controls a tank from above. I want to add some physics such as collision. When i collide with certain object i want them to respond naturally, to be rotated in a natural way etc.&#60;/p&#62;
&#60;p&#62;This video shows a similar game with the physics I want to achieve (Collision with enemy tanks and the yellow bits).&#60;br /&#62;
&#60;a href=&#34;http://www.youtube.com/watch?v=wC_9rFi9Rqo&#34; rel=&#34;nofollow&#34;&#62;http://www.youtube.com/watch?v=wC_9rFi9Rqo&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I started out with a normal cocos2d Application project. Should I stick to this or choose any of the other? &#60;/p&#62;
&#60;p&#62;Any help is highly appreciated! :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>imrank1 on "spacemanager and spritesheets"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5233#post-31883</link>
			<pubDate>Sun, 28 Mar 2010 16:58:58 +0000</pubDate>
			<dc:creator>imrank1</dc:creator>
			<guid isPermaLink="false">31883@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;thanks i beleive that fixed it!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mobilebros on "spacemanager and spritesheets"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5233#post-31782</link>
			<pubDate>Sat, 27 Mar 2010 17:11:04 +0000</pubDate>
			<dc:creator>mobilebros</dc:creator>
			<guid isPermaLink="false">31782@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Most likely its because the newer chipmunk actually has 4 moments associated with each collision.&#60;/p&#62;
&#60;p&#62;Theres begin, pre, post, seperate. You most likely only care about begin, thats what the moment variable is for.&#60;/p&#62;
&#60;p&#62;Put this if statement around the whole of your collision function:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if (moment == COLLISION_BEGIN)
   {
        //put everything in here
   }&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>imrank1 on "spacemanager and spritesheets"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5233#post-31781</link>
			<pubDate>Sat, 27 Mar 2010 17:02:51 +0000</pubDate>
			<dc:creator>imrank1</dc:creator>
			<guid isPermaLink="false">31781@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;One thing I noticed is that collisions occur with the bullet and enemy after I have removed the bullet. &#60;/p&#62;
&#60;p&#62;For example on each hit I decrease the enemies energy and only when the energy gets to zero do I remove it. However in debugging the collision processes the bullet  hit but then somehow does not remove the bullet fast enough to keep it from registering again. Any ideas on how I can get by this? &#60;/p&#62;
&#60;p&#62;- (int) handleCollisionWithEnemy:(CollisionMoment)moment arbiter:(cpArbiter*)arb space:(cpSpace*)space&#60;br /&#62;
{&#60;/p&#62;
&#60;p&#62;	CP_ARBITER_GET_SHAPES(arb,shape,enemy);&#60;/p&#62;
&#60;p&#62;	Enemy* sprite = (Enemy*)enemy-&#38;gt;data;&#60;br /&#62;
	[sprite decreaseEnergy:50];&#60;/p&#62;
&#60;p&#62;	id tintAction = [CCTintBy actionWithDuration:0.5 red:139 green:35 blue:35];&#60;br /&#62;
	[sprite runAction:tintAction];&#60;br /&#62;
	//remove the enemy if the energy is zero&#60;br /&#62;
       if ( [sprite getEnergy] == 0 )&#60;br /&#62;
	{&#60;/p&#62;
&#60;p&#62;		if (sprite)&#60;br /&#62;
		{&#60;br /&#62;
			[sprite.parent removeChild:sprite cleanup:NO];&#60;br /&#62;
			//[smgr scheduleToRemoveAndFreeShape:enemy];&#60;br /&#62;
			enemy-&#38;gt;data = nil;&#60;/p&#62;
&#60;p&#62;	}&#60;br /&#62;
	else {&#60;/p&#62;
&#60;p&#62;       //always remove the bullet&#60;br /&#62;
	CCSprite* shapeSprite = (CCSprite*)shape-&#38;gt;data;&#60;br /&#62;
	if (shapeSprite)&#60;br /&#62;
	{&#60;br /&#62;
		[shapeSprite.parent removeChild:shapeSprite cleanup:NO];&#60;br /&#62;
	//[smgr scheduleToRemoveAndFreeShape:shape];&#60;br /&#62;
		shape-&#38;gt;data = nil;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	}&#60;/p&#62;
&#60;p&#62;	return 1;&#60;/p&#62;
&#60;p&#62;}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mobilebros on "spacemanager and spritesheets"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5233#post-31513</link>
			<pubDate>Thu, 25 Mar 2010 18:48:36 +0000</pubDate>
			<dc:creator>mobilebros</dc:creator>
			<guid isPermaLink="false">31513@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;For those of you wondering the conclusion on this. The collision callbacks had the wrong signature:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;- (int) handleCollisionWithRect:(cpShape*)shape
enemy:(cpShape*)enemy
contactPts:(cpContact*)contacts
numContacts:(int)numContacts
normalCoef:(cpFloat)coef&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;This is how Chipmunk used to deal with collision handlers, the newer chipmunk deals with collision moments and stores information into a cpArbiter:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;- (int) handleCollisionWithRect:(CollisionMoment)moment arb:(cpArbiter)arb space:(cpSpace)space&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
