Questions tagged [box2d]

Box2D is a free open source 2-dimensional physics simulator engine written in C++ by Erin Catto and published under the zlib license

Box2D is a free open source 2-dimensional physics simulator engine written in C++ by Erin Catto and published under the zlib license.

The engine performs constrained rigid body simulation. It can simulate bodies composed of convex polygons, circles, and edge shapes. Bodies are joined together with joints and acted upon by forces. The engine also applies gravity, friction, and restitution.

Ports of Box2D exist for Java, ActionScript, C#, JavaScript, and D.

3289 questions
1
vote
3 answers

limit the area to move sprite by toucharea

I want to limit the area to move the sprite object only on this area (for example a area dimensions 200x200). I would to create a box2D 200x200 where the sprites can moved only on this area How do you do that please? @Override public Scene…
user1400390
  • 77
  • 1
  • 5
1
vote
1 answer

Scrolling Background cocos2d box2d

I am developing an endless horizontal scrolling iPhone-game using cocos2d and box2d. My hero has to jump over obstacles (kinematic box2d bodys) which are added on the same layer as my hero-sprite. My problem is the different speed of the parallaxe…
Thomas G.
  • 1,003
  • 12
  • 27
1
vote
1 answer

cocos2D and Box2D : How to get exact touched sprite?

I am trying to move sprite on touch moved. but when two sprites is there i am geting touch of two sprites. that's why sprites are not moving properly. - (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; { if (_mouseJoint != NULL)…
Hiren
  • 112
  • 7
1
vote
1 answer

sprite not updating to the correct position

I have written a code to display using CCLog the exact position of a sprite when a mousejoint moving it is released. Below is the Sprite.mm class and the ccTouchesEnded method (which is in the HelloWorldLayer.mm class). The sprite position is not…
newbie
  • 23
  • 5
1
vote
2 answers

Box2d get Shape Points from rotated body

I'm a little confused at the moment. If I get my Shape from my fixture in Box2d it returns me the points (with ->getVertices) related to the position of the body and angle. But shouldn't be there somewhere the stored data for the actual points of…
fehrlich
  • 2,497
  • 2
  • 26
  • 44
1
vote
1 answer

getting exact mousejoint release position of a sprite

How can I get the exact position of a sprite at the time a mousejoint moving it is released (even though the sprite might still be moving). I believe it should be coded in the ccTouchesEnded method, but I am not sure how to do it. Thanks for your…
newbie
  • 23
  • 5
1
vote
0 answers

making body swing from one rope to another

I am making a Tarzan-like game and have been brainstorming on making a body swing from one rope to another. Using Box2d and Cocos2d I have made a rope of revoulute joint segments with the body attached to lowest segment using a weldjoint. I was…
1
vote
3 answers

Best approch for side scrolling game , cocos2d box2d

I am trying to develop a game like ninja jump in ios with cocos2d + box2d with endless scrolling ! (no need of parallax scrolling) What is the best practice for endless scrolling 1 : moving the layer (Ie changing the layer position) 2 : moving the…
user500435
1
vote
1 answer

_objc_copyCppObjectAtomic undefined symbol after updating to XCode 4.4

I have just updated to XCode 4.4 and now get this linker-error: Undefined symbols for architecture armv7: "_objc_copyCppObjectAtomic", referenced from: -[CLASSNAME box2DBodiesList] in CLASSFILENAME.o ld: symbol(s) not found for architecture…
1
vote
1 answer

Touch not registered near a triangle (Box2D)?

I'm using AndEngine/Box2D to develop a game on the Android OS. When the user touches the screen, it creates a triangle using the triangle example: private static Body createTriangleBody(final PhysicsWorld pPhysicsWorld, final IAreaShape pAreaShape,…
rphello101
  • 1,671
  • 5
  • 31
  • 59
1
vote
1 answer

Box2d for JavaScript: SetLinearVelocity() isn't working

First of all, this is the first post I've written here on StackOverflow, and I'm actually new to programming, so if I say anything wrong, I'm sorry. I tried and tried to make this work - I want to simulate a body that stays still on the air, and for…
1
vote
0 answers

Cocos2d - How to Create Roller Coaster with Box2d

I want to create game like Roller Coaster and try to make Train for it.. I have tried created train with boxbody code for train : -(void)addTrainAtPos:(CGPoint)pos:(int)n:(CCLayer *)Layer { b2BodyDef BodyDef; BodyDef.type = b2_dynamicBody; …
Devang
  • 61
  • 3
1
vote
1 answer

Box2d fixture and body out of sync on retina display

I'm trying to make a cocos2d/box2d game work on iPad, iPhone and iPhone retina. My problem is, that the fixture and body don't line up on the retina simulator, please click on screenshots below for illustration (as a new stackoverflow member, it…
Matt M
  • 11
  • 1
1
vote
1 answer

box2d raycast backward compatibility issue

I recently upgraded the version of box2d to v2.2.1 in a long-running project, and it caused a number of backward-compatibility issues with existing project code. Most were resolved, except for this one b2Fixture *f =…
Emmett Butler
  • 5,969
  • 2
  • 29
  • 47
1
vote
2 answers

Why is my game crashing with no error in the LogCat (Android)?

I'm using AndEngine with Box2D to make a game for the Android OS. I'm getting the strangest error and I can't, for the life of me, figure out what is causing it. It's relatively random when it happens (although not random as to where in the code it…
rphello101
  • 1,671
  • 5
  • 31
  • 59
1 2 3
99
100