<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<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: chipmunk - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/chipmunk</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 04:11:33 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</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/chipmunk/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>breskit on "Am I doing this the right way?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28957#post-142728</link>
			<pubDate>Sun, 05 Feb 2012 09:26:25 +0000</pubDate>
			<dc:creator>breskit</dc:creator>
			<guid isPermaLink="false">142728@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi folks,</p>
<p>Apologies for the long post, but I'm a little stuck!</p>
<p>I just wanted to ask if some of you more experienced folks can tell me if I am coding my project the right way?  I think I have a couple of areas on my project that I may not be handling in the best way, so here's a question on the first.</p>
<p>In my project I'm using Chipmunk for physics and have created a number of "objects" that rotate.  One such example is a cross.  As the cross is a convex shape I have created each arm as a separate shape, so have a total of 4 shapes in my cross object (well, 5 actually as I also have a centre wheel).  These arms are joined by pivot joints around the centre of the cross and are rotated by a simple motor joints.</p>
<p>The touch event on the cross stops/starts it rotating (sets the motor angle to 0/45 accordingly).</p>
<p>My cross object is defined as so:-</p>
<pre><code>@interface _cross : CPSprite &#60;CCTargetedTouchDelegate&#62; {
    CPSprite *arm1;
    CPSprite *arm2;
    CPSprite *arm3;
    CPSprite *arm4;
    CPSprite *wheel;
    float objectMass;
    BOOL isMoving;
    cpConstraint *c1;
    cpConstraint *c2;
    cpConstraint *c3;
    cpConstraint *c4;
    cpConstraint *c5;
    cpConstraint *c6;
    cpConstraint *c7;
    cpConstraint *c8;
    cpConstraint *c9;
    cpConstraint *c10;
    float rotationAngle;
    cpSpace *mSpace;
    cpBody *mGround;

    CGRect rect1;
    CGRect rect2;
    CGRect rect3;
    CGRect rect4;
    CGRect rect5;

}</code></pre>
<p>Touch event for the cross:</p>
<pre><code>-(BOOL) containsTouch:(UITouch*) touch {

    CGPoint locationTouched = [arm1 convertTouchToNodeSpace:touch];
    BOOL isTouched1 = CGRectContainsPoint(rect1, locationTouched);

    locationTouched = [arm2 convertTouchToNodeSpace:touch];
    BOOL isTouched2 = CGRectContainsPoint(rect2, locationTouched);

    locationTouched = [arm3 convertTouchToNodeSpace:touch];
    BOOL isTouched3 = CGRectContainsPoint(rect3, locationTouched);

    locationTouched = [arm4 convertTouchToNodeSpace:touch];
    BOOL isTouched4 = CGRectContainsPoint(rect4, locationTouched);

    locationTouched = [wheel convertTouchToNodeSpace:touch];
    BOOL isTouched5 = CGRectContainsPoint(rect5, locationTouched);

    return isTouched1 &#124;&#124; isTouched2 &#124;&#124; isTouched3 &#124;&#124; isTouched4 &#124;&#124; isTouched5;
}

-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
    if (![self containsTouch:touch]) return NO;
    [self toggleMoving:mSpace withGround:mGround];
    return YES;
}</code></pre>
<p>Inside CPSprite I have an update method:</p>
<pre><code>- (void)update {
    self.position = body-&#62;p;
    self.rotation = CC_RADIANS_TO_DEGREES(-1 * body-&#62;a);
}</code></pre>
<p>And my game loop, I call the update for every CPSprite:</p>
<pre><code>-(void) step: (ccTime) delta {
    int steps = 1;
    cpFloat dt = 1.0f/60.0f/(cpFloat)steps;

    for(int i=0; i&#60;steps; i++){
        cpSpaceStep(space, dt);
    }

    for (CPSprite *sprite in batchNode.children) {

        if (sprite) {
            [sprite update];
        }
        if ([sprite isKindOfClass:[rock class]]) {
        }
    } 

    // need to check if level complete
    CGRect image_rect1 = CGRectMake(theEndGate.target.position.x,theEndGate.target.position.y,35,35);

    for (rock *arock in _rocks) {
        float rockw = arock.boundingBox.size.width;
        CGRect image_rect2 = CGRectMake(arock.position.x, arock.position.y, rockw, rockw);

        if(CGRectIntersectsRect(image_rect1, image_rect2)) {
            if (!endGateHit) {
                endGateHit = YES;
                [self addEndgatePD];
                [self endScene:TRUE];
            }
        }

    }
    cpSpaceReindexStatic(space);
}</code></pre>
<p>The CPSprite class allows me to create my CCSprite and Chipmunk body/shape. The touch delegate gives me the targeted touches agains this cross object.<br />
As part of the cross 'init' I calculate the CGRect properties for each piece of the cross so I don't have to calculate this each time I look for a touch.  The position and rotation of these are updated within CPSprite.</p>
<p>The questions I have now are:</p>
<p>1.  In pre-calculating the CGRect for the cross arms, do I need to recalculate these each time for the touch event? I don't think I do as the position/rotation appears to be updated OK.</p>
<p>2. Have I created the arms for the cross in the best way - using separate Chipmunk bodies/sprites/etc, or should I be trying to use a single Chipmunk body in someway for the whole object?</p>
<p>3. Is my main update call within the step: the most efficient way of handling this?  On some levels of my project there are as few as 12 sprites to update, but on others there can me as many as 80+.  Performance/FPS still seem quite good though (around 52fps in most cases).</p>
<p>My problem may just be down to my fat fingers not hitting the right place on the screen to toggle the moving (seems accurate when I use the mouse in simulator). Either that or I'm not calculating/using something correctly.
</p></description>
		</item>
		<item>
			<title>ruben301 on "Best way to rotate joined bodies in spacemanager?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/11113#post-63158</link>
			<pubDate>Sun, 14 Nov 2010 14:13:06 +0000</pubDate>
			<dc:creator>ruben301</dc:creator>
			<guid isPermaLink="false">63158@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi!</p>
<p>I´m very close to finish creating my first game, but i have ran into a problem. When i try to rotate a body wich is conected to two other bodies with spring and groove joints the body im trying to rotate just "vibrates" and push aside the two other bodies.<br />
I tried rotating the body like this (by using accelerometer):<br />
<code>[sprite runAction: [CCRotateBy actionWithDuration:0.1 angle:angle_modified]];</code></p>
<p>Is there an easy solution to fix this? (but not by merging the bodies)</p>
<p>Thanks in advance!
</p></description>
		</item>
		<item>
			<title>bhaskarchem on "Hit The Box (New Game in App Store)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/25498#post-132691</link>
			<pubDate>Sun, 11 Dec 2011 06:05:21 +0000</pubDate>
			<dc:creator>bhaskarchem</dc:creator>
			<guid isPermaLink="false">132691@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Check out my new game that was released on app store this week. Promo codes are not required as I have kept it free for a limited period post which the price will be back to $ 0.99. Thanks to Scott, Riq for a wonderful platform and Cocos2d forums that were of great help during the development phase.<br />
I am new to app development and this is my 1st app that I have developed using Cocos2d/Chipmunk.<br />
Let me know your comments.</p>
<p>Link to my app : <a href="http://itunes.apple.com/in/app/hit-the-box/id485881379?mt=8" rel="nofollow">http://itunes.apple.com/in/app/hit-the-box/id485881379?mt=8</a></p>
<p>------------------------------------------<br />
Bhaskar &#124; McBook Air &#124; iPhone 1st gen &#124; iPhone 4
</p></description>
		</item>
		<item>
			<title>eJayStudios on "Current state of Box2D vs Chipmunk debate?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20201#post-112505</link>
			<pubDate>Thu, 25 Aug 2011 03:47:51 +0000</pubDate>
			<dc:creator>eJayStudios</dc:creator>
			<guid isPermaLink="false">112505@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I'm thinking of making a new game with Cocos2D which will need a 2D physics engine.</p>
<p>Need to decide which one to use, tried browsing but only found old threads on the topic.</p>
<p>What is the current situation with both engines? Did Chipmunk finally caught up with Box2D functionality vise? What about speed?</p>
<p>I know there is SpaceManager wrapper for Chipmunk which sounds cool as I don't want to deal with C directly if possible.</p>
<p>Thanks for any advice!
</p></description>
		</item>
		<item>
			<title>PanzyCat on "[Chipmunk] How To Determine 3 Collisions"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28862#post-142225</link>
			<pubDate>Thu, 02 Feb 2012 00:12:18 +0000</pubDate>
			<dc:creator>PanzyCat</dc:creator>
			<guid isPermaLink="false">142225@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey everyone!</p>
<p>I have 3 separate bodies. I want to call a function when the three of them have collided. The player jumps and hits a block. If the opponent is on the block the player hits, I want the function to be called. I'm not too sure how to do this. Right now, I am using a collision handler in my player class to see if it hits the block. If this is true, the bool is sent to the opponent class where another collision handler sees if it is colliding with the block and if the bool is true. However, it doesn't really seem to be working. </p>
<p>Anyone have any suggestions?</p>
<p>Thanks!
</p></description>
		</item>
		<item>
			<title>tiggybouncer on "Sound On/Off Flag"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28010#post-137615</link>
			<pubDate>Mon, 02 Jan 2012 16:50:46 +0000</pubDate>
			<dc:creator>tiggybouncer</dc:creator>
			<guid isPermaLink="false">137615@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi Everyone! And happy new year!</p>
<p>I have a problem creating a sound on/off flag.</p>
<p>The main points:<br />
1. It is an CCMenuItem, in the Options Menu of my game.<br />
2. It is a boolean flag, which I believe is called soundOnFlag.<br />
3. I have the "Sound On" and "Sound Off" as a string (which is called 'str')</p>
<p>Here is the -(void)sound bit</p>
<pre><code>-(void)sound:(id)sender
{
	if(theGame.soundOnFlag)
	{
		theGame.soundOnFlag = FALSE;
		[self soundOn];
		//theGame.soundOnOff = @&#34;Sound On&#34;;

	}
	else
	{
		theGame.soundOnFlag = TRUE;
		[self soundOff];
		//theGame.soundOnOff = @&#34;Sound Off&#34;;

	}

}</code></pre>
<p>And then the void soundOn and void SoundOff</p>
<pre><code>-(void)soundOn
{
	str = @&#34;Sound is on!&#34;;
}

-(void)soundOff
{
	str = @&#34;Sound is off!&#34;;
}</code></pre>
<p>What's more confusing, is the fact that the label doesn't come up.</p>
<p>Thanks :)
</p></description>
		</item>
		<item>
			<title>SimzStudios on "Correct way to &quot;PAUSE&quot; game using cocos2d + spacemanager"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28430#post-139932</link>
			<pubDate>Wed, 18 Jan 2012 00:03:21 +0000</pubDate>
			<dc:creator>SimzStudios</dc:creator>
			<guid isPermaLink="false">139932@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>My understanding is that when attempting to pause a game using cocos2d + spacemanager, the following lines would suffice..</p>
<p>[[CCDirector sharedDirector] pause];<br />
[smgr stop];</p>
<p>These work well to pause the game, but on resume button being clicked I use the following lines and my app freezes..</p>
<p>[[CCDirector sharedDirector] resume];<br />
[smgr start];</p>
<p>I am not sure why this is happening :(. Any help would be appreciated, thanks in advance!</p>
<p>S. Studios
</p></description>
		</item>
		<item>
			<title>SimzStudios on "Set No Gravity In Chipmunk/Spacemanager"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28417#post-139860</link>
			<pubDate>Tue, 17 Jan 2012 15:50:43 +0000</pubDate>
			<dc:creator>SimzStudios</dc:creator>
			<guid isPermaLink="false">139860@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have been searching these forums for this answer but cannot seem to find what I am looking for. I would like to create a game that is of the Brick Breaker type where there is NO GRAVITY. Any help would be greatly appreciated! I am using SpaceManager/Chipmunk</p>
<p>Thank you in advance.</p>
<p>S.Studios
</p></description>
		</item>
		<item>
			<title>Andreas Loew on "PhysicsEditor is here!!!!!"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/13456#post-75498</link>
			<pubDate>Thu, 10 Feb 2011 19:29:50 +0000</pubDate>
			<dc:creator>Andreas Loew</dc:creator>
			<guid isPermaLink="false">75498@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>many of you might already know me from TexturePacker - now I have a new high quality tool for you:</p>
<p><a href="http://www.physicseditor.de/features">PhysicsEditor</a></p>
<p><em>Stop copy and paste!</em><br />
           <em>Stop worrying about ccw or cw!</em><br />
                      <em>Stop worrying about convex or not.</em></p>
<p>Features:</p>
<ul>
<li>Automated shape tracing(!!!)</li>
<li>Automated handling of convex polygons(!!!)</li>
<li>Automated handling of polygon oriantation(!!!)</li>
<li>Anchorpoint editor(!!!)</li>
<li>Support for Box2D and Chipmunk</li>
<li>plilst files for cocos2d</li>
<li>box2d loader code included</li>
<li>Demo</li>
</ul>
<p>The main advantage is that you can use the exporters already shipped with PhysicsEditor or simply create your own! A flexible template engine lets you export what ever text format you need.</p>
<p>The download includes a fully working demo.</p>
<p>How to use it in your code? Forget about copy and pasting vertex lists!</p>
<p>This is for box2d users:</p>
<p>Load the plist file<br />
<pre><code>[[GB2ShapeCache sharedShapeCache]   addShapesWithFile:@&#34;shapedefs.plist&#34;];</code></pre>
<p>Add the polygons to a shape<br />
<pre><code>[[GB2ShapeCache sharedShapeCache]  addFixturesToBody:body
                                   forShapeName:@&#34;shapename&#34;];</code></pre>
<p>Set the anchor point:<br />
<pre><code>[sprite setAnchorPoint:[[GB2ShapeCache sharedShapeCache]
    anchorPointForShape:@&#34;shapename&#34;]];</code></pre>
<p>Done!</p>
<p>Since I am not so familiar with chipmunk I could use some help in setting up a loader in the best way for it.</p>
<p>Cheers<br />
Andreas
</p></description>
		</item>
		<item>
			<title>mobilebros on "[Discuss] A SpaceManager Game"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/25709#post-133915</link>
			<pubDate>Sat, 17 Dec 2011 15:55:49 +0000</pubDate>
			<dc:creator>mobilebros</dc:creator>
			<guid isPermaLink="false">133915@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>This topic is in reference to the article found here: <a href="http://www.cocos2d-iphone.org/archives/1214" rel="nofollow">http://www.cocos2d-iphone.org/archives/1214</a></p>
<p>The comments section was getting way too busy with questions, so please post anything question related here for now. Thanks.
</p></description>
		</item>
		<item>
			<title>Aurigan on "displaying chipmunk joints/shapes"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4429#post-26400</link>
			<pubDate>Thu, 11 Feb 2010 23:22:43 +0000</pubDate>
			<dc:creator>Aurigan</dc:creator>
			<guid isPermaLink="false">26400@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>HI all, is there an easy way to get an on-screen representation of the joints etc. in the chipmunk 'space'. The chipmunk demos use drawspace.c to draw outline objects and lines/spots for joints and constraints ...  but it's beyond me how to integrate that into an iphone/cocos2d project. thanks
</p></description>
		</item>
		<item>
			<title>pravin on "How to detect collision of two sprite object ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/414#post-2364</link>
			<pubDate>Wed, 01 Jul 2009 12:59:53 +0000</pubDate>
			<dc:creator>pravin</dc:creator>
			<guid isPermaLink="false">2364@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>Could you help me with the following task?<br />
I have problem with collision detection of two sprite object.
</p></description>
		</item>
		<item>
			<title>venkat on "how to detect the number of colisions that object is having"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/25670#post-133653</link>
			<pubDate>Fri, 16 Dec 2011 04:18:33 +0000</pubDate>
			<dc:creator>venkat</dc:creator>
			<guid isPermaLink="false">133653@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hi friends,<br />
 can we know with how many objects that my object is colliding.<br />
ie i have some 50 object, i want  know about some 25th object that with how many objects it is colliding and with which objects its colliding .
</p></description>
		</item>
		<item>
			<title>slembcke on "New Chipmunk Showcase app"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/25545#post-132951</link>
			<pubDate>Mon, 12 Dec 2011 18:23:50 +0000</pubDate>
			<dc:creator>slembcke</dc:creator>
			<guid isPermaLink="false">132951@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p><img src="http://files.slembcke.net/temp/ChipmunkShowcase.png" /></p>
<p>I've started making a new Chipmunk Showcase app. The old one was like 3 years old, and I was getting a little embarrassed to show it to people anymore when they asked about Chipmunk. It was written for iPod 1G performance, used an ancient version of Chipmunk, used the ugly and painfully slow debug rendering code, and wasn't even retina capable. I also wanted something I could use for Chipmunk Pro sample code.</p>
<p>It's written using UIKit, GLES2, and Chipmunk Pro, so not super Cocos2D related, but it does show you how to do some neat things I thought people might be interested in seeing the code for. The physics is run on a fixed update (generally 60 Hz) while the rendering is not which allows it to run a super smooth timescale effect. It also has a fairly fast, anti-aliased, immediate mode, GLES2 based vector renderer. Once I'm done with the showcase app, I'll probably port the renderer over to Cocos2D 2.0 as a replacement for the GLES1 drawspace code that everybody uses. It batches all the geometry into a single draw call and is NEON accelerated, so it seems to run a lot faster than the old drawspace code despite giving you a much higher quality rendering.</p>
<p>Grab the code on GitHub:<br />
<a href="https://github.com/slembcke/ChipmunkShowcase" rel="nofollow">https://github.com/slembcke/ChipmunkShowcase</a></p>
<p>Not much too it yet. Three fingered left swipe to show the demo controls. Three fingered right swipe to go to the next demo.
</p></description>
		</item>
		<item>
			<title>The_Golden_Gunman on "Removing Collision Callbacks"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6002#post-35424</link>
			<pubDate>Mon, 26 Apr 2010 16:49:41 +0000</pubDate>
			<dc:creator>The_Golden_Gunman</dc:creator>
			<guid isPermaLink="false">35424@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Apologies for posting so many questions on these forums, but I am having some problems and can't seem to figure them out for myself.</p>
<p>I have a method as follows:</p>
<pre><code>- (BOOL) handleCollisionWithRect:(CollisionMoment)moment arbiter:(cpArbiter*)arb space:(cpSpace*)space
{
	if (torsoToHeadJoint)
	{
		// Remove Collision from Head.
		[smgr removeCollisionCallbackBetweenType:COLLISION_TYPE_HEAD otherType:COLLISION_TYPE_WALL];

		// Remove Joints from Head.
		// cpBody *body = head-&#62;body;
		// [smgr removeAndFreeConstraintsOnBody:body];

	}

	return YES;
}</code></pre>
<p>In this method, I am trying to de-register calls to this collision detection method. However, when calling this method, my program crashes. After debugging, the removeCollisionCallbackBetweenType method finishes execution, but the program then crashes shortly afterwards.</p>
<p>Is there any reason for this occurring?
</p></description>
		</item>
		<item>
			<title>SimzStudios on "Swipe sprite like popular game &quot;Flick Home Run&quot;"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/25420#post-132327</link>
			<pubDate>Thu, 08 Dec 2011 19:47:22 +0000</pubDate>
			<dc:creator>SimzStudios</dc:creator>
			<guid isPermaLink="false">132327@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am looking for a way to be able to swipe through a body and with that swipe be able to knock it in the appropriate direction. I found topics on touching in a sprite and flicking it but I would like the ability to begin touch from anywhere and as long as my swipe travels through the body then contact is made. Any help would be great thanks in advance!
</p></description>
		</item>
		<item>
			<title>Condor on "Jumpy and laggy chipmunk object movement"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/24755#post-130535</link>
			<pubDate>Thu, 01 Dec 2011 12:53:59 +0000</pubDate>
			<dc:creator>Condor</dc:creator>
			<guid isPermaLink="false">130535@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm using chipmunk spacemanager, level is tilemap 1000x1000 pixels, player is ball moving by accelerometer. "Camera" implemented using CCFollow.</p>
<p>When object is moving, especially on high speed, it feels very strange - jumpy and laggy. Maybe it's because CCFollow?<br />
Another strange thing - sometimes it's moving very smooth and clear, I have found no connection and causes to this behavior.</p>
<p>Also my object is bouncing of the static objects. How I can get rid of this?<br />
static objects are creating with:<br />
<pre><code>[smgr addRectAt:ccp(x+w/2,y+h/2) mass:STATIC_MASS width:w height:h rotation:0];
        staticShape-&#62;e=0.0f;
        staticShape-&#62;u=0.0f;</code></pre>
<p>All related code:</p>
<pre><code>-(id) init {
    if( (self=[super init] )) {

    self.isAccelerometerEnabled = YES;
    accX2=controller.accX;
    accY2=controller.accY;

    ...
        smgr = [[SpaceManagerCocos2d alloc] init];
        smgr.gravity=ccp(0, 0);

        [smgr addWindowContainmentWithFriction:0.0 elasticity:0.0 size:CGSizeMake(1000, 1000) inset:cpvzero radius:1.0f];

        playerHead = [smgr addCircleAt:ccp(x,y) mass:6 radius:15];
        playerHead-&#62;e=0.0f;
        playerHead-&#62;u=0.0f;
        playerHead-&#62;collision_type=kplayerCollisionType;

        [self drawWallsFromTilemap:_tileMap];
        [self drawWallsFromTilemap:_tileMap2];

        [smgr start];

        player = [PlayerSegment spriteWithFile:@&#34;player-head.png&#34;];
        player.position = ccp(x,y);
        [self addChild:player z:100];

        [self scheduleUpdate];
        [self schedule: @selector(tick:) interval:1];

        self.isTouchEnabled = YES;

        [self runAction:[CCFollow actionWithTarget:player worldBoundary:CGRectMake(0, 0, 1000,1000)]];
    }
    return self;
}

- (void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {

    playerHead-&#62;body-&#62;v=cpvzero;

    cpVect first;
    float x,y;
    x=(acceleration.x-accX2);
    y=(acceleration.y-accY2);

    first=ccp(-y *15* (400+accSense), x *15* (400+accSense));

    if(ccpLength(first)&#62;3000) first=ccpMult(first,3000/ccpLength(first));

    cpBodyResetForces(playerHead-&#62;body);
    cpBodyApplyImpulse(playerHead-&#62;body, first, ccp(0, 0));
}

-(void) update:(ccTime)deltaTime
{
	player.position = ccp(playerHead-&#62;body-&#62;p.x, playerHead-&#62;body-&#62;p.y);

        ....
}</code></pre>
<p>I tried almost everything, but behavior only getting worse in some another cases.<br />
Hope someone will find my mistake.
</p></description>
		</item>
		<item>
			<title>mandy on "[GAME]-Arcade Jumper goes Free!"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/25329#post-131730</link>
			<pubDate>Mon, 05 Dec 2011 17:16:22 +0000</pubDate>
			<dc:creator>mandy</dc:creator>
			<guid isPermaLink="false">131730@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey All! Our game Arcade Jumper is free now through the end of the week.  We used Cocos2d and Chipmunk for Arcade Jumper and absolutely love both engines!  This was my first app using Cocos2d (I'm some what of a newb), but I am pretty happy with the results!  Share any comments, questions and suggestions here! We'd love to know what the community thinks! </p>
<p><a href="http://itunes.apple.com/us/app/arcade-jumper/id439726516?ls=1&#038;mt=8#" rel="nofollow">http://itunes.apple.com/us/app/arcade-jumper/id439726516?ls=1&#038;mt=8#</a></p>
<p>Thanks all! </p>
<p>~Mandy</p>
<p>Twitter: @mandylowry @blackhivemedia
</p></description>
		</item>
		<item>
			<title>eJayStudios on "Ragdoll or not to ragdoll?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20206#post-112527</link>
			<pubDate>Thu, 25 Aug 2011 06:53:20 +0000</pubDate>
			<dc:creator>eJayStudios</dc:creator>
			<guid isPermaLink="false">112527@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>Ragdoll or not to ragdoll, this is the question :)</p>
<p>What would be a better and simpler approach for snowboarding game character? </p>
<p>At first I was thinking maybe ragdoll say with Chipmunk for all those spectacular crashes, but after extensive searches I can't find much info on ragdoll physics in Cocos2D with Box2D/Chimpunk. </p>
<p>As I don't have any prior experience with ragdoll physics, I'm bit scared to learn it all by myself (I've never even used Box2D/Chimpunk, so this complicates matters even more!)</p>
<p>So maybe it's easier just to use sprite animations? </p>
<p>What are your thoughts?
</p></description>
		</item>
		<item>
			<title>wybielacz on "Chipmunk physics + replay system"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22984#post-127040</link>
			<pubDate>Sun, 20 Nov 2011 13:23:06 +0000</pubDate>
			<dc:creator>wybielacz</dc:creator>
			<guid isPermaLink="false">127040@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I'm trying to implement a replay system in my current wip game which will allow to the user to view his/hers best run on each level. I'm using chipmunk for the physics with a fixed time step.<br />
I figured out that I have to save the position of the player at each frame and then when I want to play a replay just load and set the position of the player at each frame in the update method.<br />
The problem starts here since the above method works but not always. Sometimes it happens that the player movement  on the replay is slight different then it should be. The time between start and goal is sometimes different then it should be and sometimes even the player doesn't touch the goal point which doesn't end the replay. I even tried to save the velocity of the player instead the position but still the result are the same. </p>
<p>So my question is how to properly save and load replays of a scene using a physics engine? Should I save velocity or position or maybe something different? Is an NSMutableArray a good container to store each frame? I want to have the replay always the same as the player played. It would nice if someone with experience would help me or point me in the right direction.
</p></description>
		</item>
		<item>
			<title>The_Golden_Gunman on "Removing Joints / Constraints using SpaceManager?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5994#post-35387</link>
			<pubDate>Mon, 26 Apr 2010 11:16:00 +0000</pubDate>
			<dc:creator>The_Golden_Gunman</dc:creator>
			<guid isPermaLink="false">35387@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>How does one go about removing constraints / joints using the SpaceManager with Chipmunk?</p>
<p>I am calling:</p>
<p><code>[self removeChild:joint];</code></p>
<p>When trying to remove a slide joint added between two bodies. This removes the joint from view (it is no longer rendered), however the bodies attached via the joint still behave as if they are connected via the joint.
</p></description>
		</item>
		<item>
			<title>gametreesnet on "Using Cocos2d with small physics function, not Box2d or Chipmunk"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22766#post-126052</link>
			<pubDate>Mon, 14 Nov 2011 22:56:21 +0000</pubDate>
			<dc:creator>gametreesnet</dc:creator>
			<guid isPermaLink="false">126052@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello!<br />
I'm here to get some opinions on using cocos2d as a small physics function.<br />
I've spent using objective c for a bit of time and now hooked into it.<br />
Also, Cocos2d made it even more fascinating and fun!<br />
However, when I am creating my game, I found I need to add some physic functions to my game.<br />
Well, the ones i'm thinking about is not very hard ones, so i was thinking, is it ok to use cocos2d as a small physics function?<br />
I've heard about Box2d and Chipmunk, but they are written in C and C++, which I'm not really into (even though i did a bit of C#).</p>
<p>So my question is, is it still effective to use a normal Cocos2d Engine as a small physics tool?<br />
Thanks.
</p></description>
		</item>
		<item>
			<title>Tadegol on "Remove cpShape after collision"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22461#post-124656</link>
			<pubDate>Sat, 05 Nov 2011 22:52:46 +0000</pubDate>
			<dc:creator>Tadegol</dc:creator>
			<guid isPermaLink="false">124656@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hello, </p>
<p>Sorry if my topic is on worng section. </p>
<p>I have a very headache with handler collision on chopmunk. i need some help please.<br />
My problem:</p>
<p>i'm trying to remove(clear, disappear, delete or something like that) some shape after his collision. </p>
<p>Code:</p>
<p>- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event<br />
{</p>
<p>    UITouch *touch = [touches anyObject];<br />
    CGPoint location= [touch locationInView:[touch view]];<br />
    location = [[CCDirector sharedDirector] convertToGL:location];</p>
<p>    cpShape *ballShape = [sm addCircleAt:ccp(100, 200) mass:5 radius:25];<br />
    cpCCSprite *flake= [cpCCSprite spriteWithShape:ballShape file:@"ballon.png"];<br />
    flake.position = ccp(location.x, location.y);</p>
<p>    id animation = [CCMoveTo actionWithDuration:2 position:ccp(flakeImage.position.x-20, flakeImage.position.y-200)];</p>
<p>    [flake runAction:animation];</p>
<p>    flake.shape-&#62;collision_type=1;<br />
    flower.shape-&#62;collision_type=2;<br />
    [self addChild:flake];</p>
<p>    [sm addCollisionCallbackBetweenType:1 otherType:2 target:self selector:@selector(handleCollision:arbiter:space:)];</p>
<p>}</p>
<p>This method works fine,draw a shape that is falling and making a collapse to other one .</p>
<p>- (void) handleCollision:(CollisionMoment)moment arbiter:(cpArbiter*)arb space:(cpSpace*)space<br />
{<br />
    CP_ARBITER_GET_SHAPES(arb,a,b);<br />
    switch(moment)<br />
    {<br />
        case COLLISION_BEGIN:<br />
            //do something at the beginning<br />
            NSLog(@"Has been collision");<br />
            //Remove shape<br />
             [sm removeAndFreeShape:a];<br />
            break;<br />
    }</p>
<p>}<br />
Here is the problem,  NSLog(@"Has been collision"); works fine, but  when execute [sm removeAndFreeShape:a]; i have "EXC_BAD_ACCESS".</p>
<p>Please, any suggestion or solution to solve this ?</p>
<p>Thanks.
</p></description>
		</item>
		<item>
			<title>eddcooper on "Dragging a sprite with chipmunk and spacemanager - morphShapeToActive not workin"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22610#post-125464</link>
			<pubDate>Thu, 10 Nov 2011 23:14:57 +0000</pubDate>
			<dc:creator>eddcooper</dc:creator>
			<guid isPermaLink="false">125464@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi guys,</p>
<p>I think I'm missing something obvious here. I'm trying to enable dragging functionality on a sprite when a user touches the screen (and make the sprite shape static whilst dragging so it won't be affected by physics, and active again when the drag ends it becomes affected by physics again). This seems like it should be really simple but in my code the sprite never moves after you stop dragging and seems like it remains static. </p>
<p>In fact the morphShapeToActive code seems to stop the sprite moving whenever I experiment calling it from different places. Very strange. Any help would be awesome!</p>
<p>I'm using chipmunk 6.0.1, cocos2d 1.0.0 and spacemanager 0.1.1</p>
<p>My code follows:</p>
<p><code><br />
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "cocos2d.h"<br />
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "SpaceManagerCocos2d.h"<br />
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "chipmunk.h"</p>
<p>// HelloWorldLayer<br />
@interface HelloWorldLayer : CCLayer<br />
{<br />
	SpaceManagerCocos2d *smgr;<br />
	cpCCSprite *mouseSprite;</p>
<p>	BOOL grabbingMouse;</p>
<p>}</p>
<p>// returns a CCScene that contains the HelloWorldLayer as the only child<br />
+(CCScene *) scene;</p>
<p>@end</p>
<p>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "HelloWorldLayer.h"</p>
<p>// HelloWorldLayer implementation<br />
@implementation HelloWorldLayer</p>
<p>+(CCScene *) scene<br />
{<br />
	// 'scene' is an autorelease object.<br />
	CCScene *scene = [CCScene node];</p>
<p>	// 'layer' is an autorelease object.<br />
	HelloWorldLayer *layer = [HelloWorldLayer node];</p>
<p>	// add layer as a child to scene<br />
	[scene addChild: layer];</p>
<p>	// return the scene<br />
	return scene;<br />
}</p>
<p>// on "init" you need to initialize your instance<br />
-(id) init<br />
{<br />
	// always call "super" init<br />
	// Apple recommends to re-assign "self" with the "super" return value<br />
	if( (self=[super init])) {<br />
		self.isTouchEnabled = YES;</p>
<p>		smgr = [[SpaceManagerCocos2d alloc] init];<br />
		[smgr addWindowContainmentWithFriction:1.0 elasticity:1.0 inset:cpvzero];</p>
<p>		CCSprite *background = [CCSprite spriteWithFile:@"smgrback.png"];<br />
		background.position = ccp(240,160);<br />
		[self addChild:background];</p>
<p>		[smgr addSegmentAtWorldAnchor:cpv(72,13) toWorldAnchor:cpv(480,13) mass:STATIC_MASS radius:1];<br />
		[smgr addSegmentAtWorldAnchor:cpv(72,13) toWorldAnchor:cpv(72,133) mass:STATIC_MASS radius:1];<br />
		[smgr addSegmentAtWorldAnchor:cpv(72,133) toWorldAnchor:cpv(0,133) mass:STATIC_MASS radius:1];</p>
<p>		[self addChild:[smgr createDebugLayer]];</p>
<p>	    cpShape *mouse = [smgr addCircleAt:cpv(200,160) mass:17.0 radius:25];<br />
		mouseSprite = [cpCCSprite spriteWithFile:@"mouse.png"];<br />
		mouseSprite.shape = mouse;</p>
<p>		[self addChild:mouseSprite];</p>
<p>		for (int i=0; i&#60;2; i++) {<br />
			cpShape *flower = [smgr addCircleAt:cpv(230 + (i * 5),18 + (i * 10)) mass:10.0 radius:17];<br />
			cpCCSprite *flowerSprite = [cpCCSprite spriteWithFile:@"flower.png"];<br />
			flowerSprite.shape = flower;<br />
			[self addChild:flowerSprite];<br />
		}</p>
<p>		for (int i=0; i&#60;25; i++) {<br />
			cpShape *miniFlower = [smgr addCircleAt:cpv(110 + (i * 5),18 + (i * 10)) mass:6.0 radius:5];<br />
			cpCCSprite *miniFlowerSprite = [cpCCSprite spriteWithFile:@"flowersmall.png"];<br />
			miniFlowerSprite.shape = miniFlower;<br />
			[self addChild:miniFlowerSprite];<br />
		}</p>
<p>		[smgr start];</p>
<p>	}<br />
	return self;<br />
}</p>
<p>-(void) registerWithTouchDispatcher<br />
{<br />
	[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];<br />
}</p>
<p>- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {</p>
<p>	CGPoint pt = [self convertTouchToNodeSpace:touch];</p>
<p>	//Get the vector of the touch (the different between mr mouses position and the touch)<br />
	if (CGRectContainsPoint(mouseSprite.boundingBox, pt)) {<br />
		grabbingMouse = YES;<br />
		[smgr morphShapeToStatic:mouseSprite.shape];<br />
	}<br />
	else {<br />
		[smgr applyLinearExplosionAt:pt radius:240 maxForce:3000];</p>
<p>		grabbingMouse = NO;<br />
	}</p>
<p>	return YES;<br />
}</p>
<p>-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event {</p>
<p>	if (grabbingMouse) {<br />
		CGPoint pt = [self convertTouchToNodeSpace:touch];<br />
		mouseSprite.position = pt;<br />
	}</p>
<p>}</p>
<p>-(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event<br />
{<br />
	if (grabbingMouse) {</p>
<p>		[smgr morphShapeToActive:mouseSprite.shape mass:17.0];<br />
		[mouseSprite stopAllActions];<br />
	}<br />
	grabbingMouse = NO;</p>
<p>	NSLog(@"Touch Ended");</p>
<p>}</p>
<p>- (void) dealloc<br />
{<br />
	[super dealloc];<br />
}</p>
<p>@end<br />
</code>
</p></description>
		</item>
		<item>
			<title>caveboy on "[spaceManager] add friction to object"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22592#post-125357</link>
			<pubDate>Thu, 10 Nov 2011 11:51:07 +0000</pubDate>
			<dc:creator>caveboy</dc:creator>
			<guid isPermaLink="false">125357@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everyone, im developing a game that has a top down perspective. To achieve this im using chipmunk/spacemanager and i have set gravity to zero. I'm applyingImpulse to a ball sprite/shape, which works great but it never seems to slow to a stop.<br />
I'd really like to add some friction to the ball so it would stop because when it does, i have a reload function that runs. </p>
<p>I've been looking at arbiter values but i have no idea what to change, if that is the right route. Thanks for any help, its greatly appreciated!
</p></description>
		</item>
		<item>
			<title>kosa_nostra on "Realistic collisions with blocks"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22444#post-124566</link>
			<pubDate>Sat, 05 Nov 2011 00:34:19 +0000</pubDate>
			<dc:creator>kosa_nostra</dc:creator>
			<guid isPermaLink="false">124566@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,<br />
I'm working on a little game involving physics. I use chipmunk. I created a cpBody and a cpShape attached to a CCSprite. This represents a "block" (a long rectangle). When a collision occurs between this block or some other objects, the block moves just linearly. For example, when the top of the block is hit, I'd like to see the block rotate, and not just move as if it has been hit to its center.</p>
<p>Any help would be great !</p>
<p>Regards,<br />
Kosa
</p></description>
		</item>
		<item>
			<title>vidoclaude on "Chipmunk: moving static shape, but dynamic shape on top doesn&#039;t move with it"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/16974#post-95674</link>
			<pubDate>Thu, 26 May 2011 14:56:34 +0000</pubDate>
			<dc:creator>vidoclaude</dc:creator>
			<guid isPermaLink="false">95674@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi Guys, </p>
<p>Long time reader, first time poster, you guys do a great job with helping people and thats great!</p>
<p>Wondering if you could shed any light on my issue, I'm using chipmunk (and spacemanager) to make a side scrolling game where the scrolling is infinite. To achieve this so far, I've got two static shapes, each the the width of the screen, and am looping them across the screen to act as my floor, that part is working fine.</p>
<p>So, the floor is infinitely scrolling away nicely, but when I place a dynamic shape onto the scrolling floor, it stays in the same place, instead of being dragged along by the scrolling floor on which it sits.</p>
<p>Here's my code for creating and moving the floor</p>
<p><code><br />
       CGPoint vertices_floor[] = {<br />
            ccp(-239.375000f, 33.750000f),<br />
            ccp(240.041718f, 32.984718f),<br />
            ccp(240.041718f, -34.293861f),<br />
            ccp(-239.500000f, -34.375000f)<br />
      };</p>
<p>        // Floor 1<br />
        cpShape *floorShape = [spaceMgr addPolyAt:cpv(wins.width/2, 34) mass:STATIC_MASS rotation:0 numPoints:4 pointsArray:vertices_floor];<br />
        floorShape-&#62;group = 2;<br />
        floorShape-&#62;u = 4;<br />
        floorSprite = [cpCCSprite spriteWithShape:floorShape file:@"floor.png"];<br />
        [self addChild:floorSprite];</p>
<p>        //floor 2<br />
        cpShape *floorShape2 = [spaceMgr addPolyAt:cpv(wins.width + (wins.width/2), 34) mass:STATIC_MASS rotation:0.0 numPoints:4 pointsArray:vertices_floor];<br />
        floorShape2-&#62;group = 2;<br />
        floorShape2-&#62;u = 4;<br />
        floorSprite2 = [cpCCSprite spriteWithShape:floorShape2 file:@"floor.png"];<br />
        floorSprite.flipX = YES; //flip sprite to match up with previous sprite<br />
        [self addChild:floorSprite2];<br />
        scrollSpeed = 1.0f;</p>
<p>        //floor 1 movement code<br />
        id Floor1MoveScreenToLeft = [CCMoveTo actionWithDuration:10 position:ccp(-wins.width/2, floorSprite.position.y)];<br />
        id Floor1MoveScreenToMiddle = [CCMoveTo actionWithDuration:10 position:ccp(wins.width/2, floorSprite.position.y)];<br />
        id Floor1BackOfScreen = [CCMoveTo actionWithDuration:0 position:ccp(wins.width + (wins.width/2), floorSprite.position.y)];</p>
<p>        //Floor 2 movement code<br />
        id Floor2MoveScreenToLeft = [CCMoveTo actionWithDuration:10 position:ccp(-wins.width/2, floorSprite2.position.y)];<br />
        id Floor2MoveScreenToMiddle = [CCMoveTo actionWithDuration:10 position:ccp(wins.width/2, floorSprite2.position.y)];<br />
        id Floor2BackOfScreen = [CCMoveTo actionWithDuration:0 position:ccp(wins.width + (wins.width/2), floorSprite2.position.y)];</p>
<p>        //run actions...<br />
        [floorSprite runAction:[CCRepeatForever actionWithAction:[CCSequence actions: Floor1MoveScreenToLeft, Floor1BackOfScreen, Floor1MoveScreenToMiddle, nil]]];<br />
        [floorSprite2 runAction:[CCRepeatForever actionWithAction:[CCSequence actions: Floor2MoveScreenToMiddle, Floor2MoveScreenToLeft, Floor2BackOfScreen, nil]]];<br />
</code></p>
<p>And here's the dynamic shape (a box) that I'm dropping onto the scrolling floor that remains still and doesn't get dragged across and off the screen by the scrolling floor</p>
<p><code><br />
    CGPoint vertices_crate[] = {<br />
            ccp(-18.571484f, 14.714355f),<br />
            ccp(18.625000f, 15.250000f),<br />
            ccp(19.000000f, -15.875000f),<br />
            ccp(-18.214355f, -15.641598f)<br />
    };</p>
<p>        cpShape * crate_Shape = [spaceMgr addPolyAt:cpv((wins.width/2) - 70 , wins.height/2) mass:20 rotation:90.0 numPoints:4 pointsArray:vertices_crate];<br />
        crate_Shape-&#62;group = 3;<br />
        cpCCSprite * crate_Sprite = [cpCCSprite spriteWithShape:crate_Shape file:@"crate.png"];<br />
        [self addChild:crate_Sprite];<br />
</code></p>
<p>Hope that lot made sense! I'd very much appreciate any words of wisdom!</p>
<p>Cheers,</p>
<p>Dave.
</p></description>
		</item>
		<item>
			<title>wybielacz on "chipmunk + fixed time step"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22408#post-124341</link>
			<pubDate>Thu, 03 Nov 2011 12:51:38 +0000</pubDate>
			<dc:creator>wybielacz</dc:creator>
			<guid isPermaLink="false">124341@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I have read this article about fixing the time step in physics<br />
<a href="http://gafferongames.com/game-physics/fix-your-timestep/" rel="nofollow">http://gafferongames.com/game-physics/fix-your-timestep/</a></p>
<p>Following the article I could fix my timestep but I still have the visually unpleasant stuttering of the physics simulation. The problem is that I do not really understand how should I implement the last step "The final touch" to stop the stuttering of the physics simulation.</p>
<p>My step function currently looks like this:<br />
<pre><code>-(void) step: (ccTime) delta
{

    if ( delta &#62; 0.25 )
        delta = 0.25;	

    accumulator += delta ;

    while ( accumulator &#62;= 0.01 )
    {

    cpSpaceStep(space, 0.01);

    cpSpaceEachShape(space,eachShape,nil) ;

       accumulator -= 0.01;

    }

}</code></pre>
<p>Could somebody point me or explain me what I should exactly do or change to completely fix my timestep without the stuttering of the physics simulation? Any help would be really appreciated.
</p></description>
		</item>
		<item>
			<title>Theronen on "[Solved] Extremely Odd Chipmunk Error"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22264#post-123594</link>
			<pubDate>Sat, 29 Oct 2011 21:43:47 +0000</pubDate>
			<dc:creator>Theronen</dc:creator>
			<guid isPermaLink="false">123594@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>EDIT: I fail... forgot the asterisks behind cpSpace, help is no longer needed.</p>
<p>In my main file I am creating a space, then initializing another file using that space using this method:<br />
<pre><code>- (id)initWithSpace:(cpSpace)space position:(cpVect)position;</code></pre>
<p>I setup my space with the following:<br />
<pre><code>- (void)createSpace
{
    cpInitChipmunk();
    space = cpSpaceNew();
    space-&#62;gravity = ccp(0, -100);
    cpSpaceResizeStaticHash(space, 400, 200);
    cpSpaceResizeActiveHash(space, 200, 200);
}</code></pre>
<p>From there I go to initialize my other file with the code:<br />
<pre><code>OtherFile *file = [[[OtherFile alloc] initWithSpace:space position:pos];
    [self addChild:file];</code></pre>
<p>On compile I get some errors which simply don't make any sense, if anyone has any ideas, assistance would be greatly appreciated.</p>
<p>Sending 'cpSpace *' (aka 'struct cpSpace *') to parameter of incompatible type 'cpSpace *' (aka 'struct cpSpace *')<br />
Confused by earlier errors, bailing out
</p></description>
		</item>
		<item>
			<title>trevarthan on "cocos2d 2.0 - Chipmunk - drawSpace.c missing"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21960#post-122057</link>
			<pubDate>Wed, 19 Oct 2011 15:15:11 +0000</pubDate>
			<dc:creator>trevarthan</dc:creator>
			<guid isPermaLink="false">122057@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I've noticed that cocos2d 2.0 does not include drawSpace.c. I tried the version from Chipmunk git, but it heavily references to OpenGL/gl.h, which we don't have on iphone/ipad (we only have OpenGLES). My old version of drawSpace.c from 9.99.x days no longer works. I get errors like this:</p>
<p>		if(body-&#62;node.next){</p>
<p>'cpBody' has no member named 'node'.</p>
<p>Given that the Chipmunk API has obviously changed since 5.x, has anyone managed to port the new drawSpace.c?
</p></description>
		</item>

	</channel>
</rss>

