Questions tagged [box2d-iphone]

Box2D is a physics engine created by Erin Catto. This tag is similar to the box2d tag in that it is more specifically aimed at iOS development.

Box2D is a physics engine that is particularly popular among Cocos2D developers when developing a game for iOS devices. It is fairly fast and easy to use. More information can be found on its official website:

Box2D.org

For more information on Cocos2D (iOS) see:

Cocos2D-iPhone.org

410 questions
0
votes
1 answer

Cocos2D+Box2D iPhone : How to identify b2body and ground body collision?

I used b2ContactListener class to identify collision. All other body collision identification is successful. How can I find other b2body collision with ground body?
Guru
  • 21,652
  • 10
  • 63
  • 102
0
votes
2 answers

Body Moves continuos when tap on screen

I want to move my body continuos when i touch screen and stop when i release touch. I am using box2d and cocos2d and i really dont know why my code cant not perform very well. i an using touchesBegan for sprite body movement …
Diken Shah
  • 69
  • 6
0
votes
1 answer

Apple Mach-O Linker (Id) Error Issue

I've read a number of posts on this issue but I haven't found anything particularly helpful. I am trying to make a weldJoint when two sprites meet using a contact listener. I keep getting the following error: Apple Mach-O Linker (Id)…
dropcode
  • 15
  • 4
0
votes
1 answer

How can my sprite body will jump and come back to original place in box2d

How can my sprite will jump and come back to original place?? I am using box2d physics engine in iphone apps. I am using impulse but cant work properly. Is any one know the logic or code than tell me. -(void)jump { b2Vec2…
Diken Shah
  • 69
  • 6
0
votes
1 answer

contact listener issues

I don't know much C++ and I am trying to implement a solution I found - (Getting the world's contactListener in Box2D) using Cocos2d-box2d. Here is the Contact Listener. SubcContactListener.h: #import #import…
dropcode
  • 15
  • 4
0
votes
2 answers

Creating a contact listener when sprites from different classes meet

I want to create a contact listener in such a way that I'll be able to create a joint when sprites from different classes meet. I found a useful question and answer which has helped me - Getting the world's contactListener in Box2D partly. The…
dropcode
  • 15
  • 4
0
votes
1 answer

How to find collision detection between sprite and bezier

I usually use box2d for collision detection between two sprites like below code - (void)beginContact:(b2Contact *)contact { b2Fixture *fixtureA = contact->GetFixtureA(); b2Fixture *fixtureB = contact->GetFixtureB(); b2Fixture *fixtureC =…
0
votes
1 answer

How to restrict an impulse after a jump in box2d?

How could I restrict an impulse ? I would like the body to jump fast, and restrict his jump after that. I am looking for something like the following, a friction after the impulse, but this is not working (the player stays at its position in the…
Paul
  • 6,108
  • 14
  • 72
  • 128
0
votes
1 answer

accessing tags from different classes - cocos2d

This might sound quite straightforward. How can tags from one class accessed in another in cocos2d. I plan to use these tags to create a contact listener between a rope (rope class made of revolute joints) and a sprite (sprite class). Thanks in…
wilM
  • 157
  • 1
  • 9
0
votes
2 answers

Calling another method from Cocos2d Hud layer

I have two class files hudlayer.m and actionlayer.m I have a method named jump in hudlayer.m And i have a method named jumpone in actionlayer.m -(void) jumpone { _heroBody->ApplyLinearImpulse(b2Vec2(_playerVelX/[_lhelper pixelsToMeterRatio],…
vishnu
  • 869
  • 1
  • 16
  • 25
0
votes
1 answer

accessing b2Fixture

I have two classes for sprites and would like to access the b2Fixture of the sprites in the HelloWorldLayer.mm. What is the most appropriate way to access these properties? I plan to create a weld joint between them on contact. Please Help.
wilM
  • 157
  • 1
  • 9
0
votes
2 answers

Box2D Detecting when 2 specific edges touch

I am working on a Cocos2D project using Box2D and I am trying to detect when 2 specific edges on an object touch, for example for the red edges in the images below: I am still learning collisions but I understand the basics and how to detect if 2…
RyanG
  • 4,393
  • 2
  • 39
  • 64
0
votes
2 answers

Cocos2d access scene properties and methods

I'm trying to include a pause feature for my game. So far running pause on the [CCDirector sharedDirector] has been good enough when run through my pauseGame method (which incorporates a BOOL to tell if game is paused, etc.) However, I noticed that…
user339946
  • 5,961
  • 9
  • 52
  • 97
0
votes
2 answers

accessing array from one class in another - cocos2d

This might sound pretty straightforward. I have populated an array with PhysicsSprites in a class (Sprites.mm) that returns itself (which I initialize in the init method HelloWorldLayer.mm class). How can access the array (from Sprites.mm) in the…
wilM
  • 157
  • 1
  • 9
0
votes
1 answer

Random crashes from Cocos2d actions

I'm getting a few inconsistent crashes whenever some CCAction is being applied to a sprite. Ex: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[CCScaleBy actionWithDuration:scale:]: unrecognized selector sent…
user339946
  • 5,961
  • 9
  • 52
  • 97