Box2D is an open-source rigid-body 2D physics simulation library for games, written in C++.

learn more… | top users | synonyms

0
votes
2answers
564 views

How to move Objects smoothly like swimming arround

I have a Box2D project that is about to create a view where the user looks from the Sky onto Water. Or perhaps on a bathtub filled with water or something like this. The Object which holds the fluid ...
2
votes
1answer
655 views

Pathfinding and BSP with Box2D

I'm looking into implementing AI in my 2D side-scrolling platformer, and I'm looking into using algorithms such as A*. For many kinds of pathfinding, we need some sort of grid or systems of nodes or ...
3
votes
1answer
2k views

Andengine. Put bullet to pool, when it leaves screen

i'm creating a bullet with physics body. Bullet class (extends Sprite class) has die() method, which unregister physics connector, hide sprite and put it in pool public void die() { ...
0
votes
1answer
182 views

Box2d — get free space

I am developing a little Game with something like particles, where every particle is represented by a box2d Body. To insert new particles I need to find a place in the b2World where no bodies reside. ...
4
votes
1answer
2k views

making a box2d body move along a Bezier curve/ arc path

I have been trying to make a box2d body move along a Bezier curve/ arc path. Most of the posts I've seen recommend an approach of manipulating SetLinearVelocity and SetTransform to arrive at an ...
1
vote
2answers
2k views

Can i add friction in air?

I have issue regarding speed in air. When i jump and move simultaneously that time speed of player increase.For jump i am using impuls and for movement i am using force.I want to slow speed when ...
1
vote
2answers
683 views

strange behavior in Box2D+LibGDX when applying impulse

I have been playing around with Box2D and LibGDX and have been using a sample code from DecisionTreeGames as the testing ground. Now I have a screen with four walls and a rectangle shape, lets call it ...
6
votes
1answer
679 views

Farseer Physics: Ways to create a Body?

I want to create something similar to this using farsser and Kinect: https://vimeo.com/33500649 This is my implementation until now: http://www.youtube.com/watch?v=GlIvJRhco4U I have the outline ...
0
votes
1answer
225 views

Creating multiple fixtures in one body

I want to create this type of fixture in one body. Here square and circle both are different fixtures but attach to one body. How do I do this?
1
vote
2answers
227 views

Confusing box2d forces

Hello Friends. This is my demo game screen-shoot. Here i am using three buttons. Right-bottom button is used for jump and left-bottom buttons used for move left and right. I have some questions 1) ...
1
vote
0answers
794 views

How to properly add texture to multi-fixture/shape b2Body

Hello to everyone this is my first poste here I hope that will be not fail start. At start I must say I make part 1 in Ray's Tutorial "How To Make A Game Like Fruit Ninja With Box2D and Cocos2D". But ...
1
vote
1answer
162 views

Sprite Body can not stop

Hey i have issue regarding jump sprite body. In my code i am using moveLeft and moveRight Button and when i am press moveRight Button using following code if (moveRight.active==YES) { ...
0
votes
1answer
422 views

moving box2d bodies in an arc or curved path

How can I make a b2Body move in a arc-like or curved path? I have heard about cocos2d Bezier curve function (ccBezier) but this is for moving cocos2d sprites. Or can it be modified to move box2d ...
0
votes
1answer
582 views

EXC_BAD_ACCESS error when box2d joint is destroyed

When I destroy the weldJoint in the update method (see below) I get an EXC_BAD_ACCESS error pointing to the line world->DestroyJoint(weldJoint); in the update method below: -(void) update: ...
0
votes
2answers
447 views

How to move a b2Body explosively to a new Location

I am building an Game based on Box2d with the following basic structure: The Box2d World itself does not have any Gravity and is filled with some bodies (sheres and simple polygons) of more or less ...
1
vote
1answer
995 views

AndEngine Physics: Shape rotating but not updating physics effects

I was looking at PhysicsExample from AndEngine's Examples. I made the following change that I added a vertical line shape and created a fixture for it. Then I registered a rotation modifier for that ...
0
votes
0answers
138 views

Farseer non-colliding bodies affect eachother

I'm trying to use Farseer to make a tile engine, but bodies that are not colliding with a sprite are still having an effect on it. In this image there is a single sprite(the green box) and a single ...
1
vote
1answer
402 views

Cocos2d: Using single timer/scheduler for multiple sprites

want to know if is it possible to use single timer or scheduler method for multiple sprites ? Like I am now working on a game and there could be any number of sprites and i want to perform some ...
3
votes
1answer
323 views

What algorithms exist for generating collision geometry from an image?

I am currently working on a game using SFML and Box2D. I am interested in generating collision geometry from the sprite data that I load into SFML. So, for example, an algorithm that would do this ...
2
votes
0answers
315 views

Box2d based tile map game scrolling problem [closed]

I am using a tile based game and also used a joystick. Using joystick sprite body move perfectly but tile map can not scroll. -(void)setCenterOfScreen:(b2Vec2)position { int ...
-2
votes
1answer
2k views

How change the size of sprite in cocos2d?

I want to change the scale of sprite like a paper in 'Paper Toss' game. 'Paper Toss' is the game is available on the App store. I want to make a sprite like a paper and change the scale of sprite ...
0
votes
1answer
530 views

Cocos2d Box2d contact listener call different method in collided object

I have the building object, wen it hit with other, i want to call some method inside it. Building.mm -(void)printTest { NSLog(@"printTest method work correctly"); } in my ContactListener i ...
1
vote
1answer
553 views

How make a laser path prediction line like a “slingshot cowboy” game?

How so I make a laser path prediction line like a “slingshot cowboy” game in cocos2d or box2d and select the target like "slingshot cowboy" game.
6
votes
2answers
639 views

Show path of a body of where it should go after linear impulse is applied

I am making a game with Andengine and Box2D. I have a dynamic body and I apply linear impulse on the body to move it around when the user have touched the screen. Now I want to show the path where ...
1
vote
1answer
291 views

How do I identify a collision with a specific body?

How can I identify when the ground body collides with another b2Body? I can use b2ContactListener to be notified of collision events, but how do I tell which bodies collided?
-1
votes
1answer
149 views

Interacting with box2D objects

How can I interact with an object in box2d, I'm completely new to this so I have no clue what to do. The box is created like this: bodyDef.type = b2Body.b2_dynamicBody; fixDef.shape = new ...
1
vote
1answer
116 views

Why is the MaskBit maxed out

Hi there for some reason the maskbit of my b2FixtureDef is being maxxed out and im not sure why Here is the declaration of the items that are used in the game enum PhysicBits { PB_NONE = 0x0000, ...
1
vote
2answers
220 views

Box 2D Collision Question

I am very new to Box 2D Physics world. I wanted to know how to collide 2 bodies when one is Dynamic and other is Kinematic. The whole Scenario is explained below: I have 3 balls in total. I want to ...
4
votes
1answer
479 views

Cocos2d: Tongue effect like in Munch Time

I'm wanting to do a tongue effect for my character like the one in Munch Time( shown in pic ). The player does some action and his tongue attaches to the nearest platform. I'm thinking this is ...
1
vote
0answers
248 views

Design pattern for procedural terrain assets

I'm developing a procedural terrain class at the moment and am stuck on the correct design pattern. The terrain is 2D and is constructed from a series of (x,y) points. I currently have a method that ...
2
votes
2answers
963 views

Simple 2D Flight Physics with Box2D

I'm trying to build a simple side scroller with an airplane being the player. As such, I want to build simple flight controls with simple but realistic-feeling physics. I'm making use of cocos2D and ...
1
vote
1answer
953 views

RevoluteJoint Stop Rotating when Some Physics Body Collide in Andengine + Box2d?

I am making a Game from andengine + box2d in Which i am using RevoluteJoint in that case i am facing some problem that when physics body or Sprite Collide with this Revolute joint body then Revolute ...
2
votes
4answers
1k views

Should I used Box2D for a Flash platformer or use something for gaming like Fixel or Flashpunk?

I'm trying to make a platformer with Flash/AS3 and have been looking for something to help with some of the collision etc. I've look at a few engines and Box2D/WCK seems the most sophisticated. Do I ...
7
votes
4answers
2k views

How do I make my rain effect look more like rain and less like snowfall?

I am making a game in that game I want a rain effect. I am little bit far from this right now. I am creating the rain effect like below: particleSystem.addParticleInitializer(new ColorInitializer(1, ...
-4
votes
2answers
922 views

How can I create a rain effect?

I'm making a game in which I want a rain effect, like rain is coming and game play normally.
0
votes
1answer
2k views

How to simulate a water splash effect?

I need to achieve the effect of a ball falling down into a pool then splashing in the water. At first, I made a sensor to detect the collision between the ball and the water and then show the sprite ...
1
vote
1answer
2k views

Setting a Box2D Bodies Center?

How do I set the center of a fixture/body consisting of multiple shapes (triangles)?
1
vote
1answer
484 views

Store and create game objects at positions along terrain

I have a circular character that rolls down terrain like that shown in the picture below. The terrain is created from an array holding 1000 points. The ground is drawn one screen width infront and ...
2
votes
2answers
236 views

Moving 2d camera in the y direction

I'm developing a simple game for the iphone and am struggling to work out the best way for the camera to follow the main character. The following picture hightlights the three main components: ...
2
votes
2answers
847 views

Box2d debug render

How can I render the body and joints in the physics world? During research I found the class called Box2dDebugRenderer. But when I put it into use it was full of errors. I do not found some classed in ...
4
votes
3answers
557 views

Box2d Collision problem

I'm not good with words so here's a picture to describe my problem: In my game there is this big ball which the user can move on x-axis only. Now, if the ball is falling like the red one, it's ...
-3
votes
1answer
197 views

JointDef Modify at Runtime

In my game, I want run time modification in object body so I want to modify the joint def according to situation. So provide comment for how to modify jointdef run time.
4
votes
3answers
4k views

Remove gravity from single body

I have multiple bodies in my game world in andengine. All the bodies affected by gravity but in that I want my specific body does not affected by the gravity. For that solution after research I found ...
0
votes
1answer
568 views

in box2d how to decrease joint's reaction force?

I'm trying to make a game like cut the rope and meet some problems. when I create a float bubble and connect with a rope(a sets of bodies connected with revoluteJoint), the rope will become longer and ...
0
votes
2answers
1k views

Constant rotation of a revolute joint in box2d

I would like to have a line with one end attached to a location and have it rotate constantly (with the same speed) with a maximum of 45 to -45 degrees (i.e. I would like to have it swing like a rope ...
5
votes
1answer
480 views

Do I need to roll my own polygon segmentation algorithm to automate Box2d body creation from a tile map?

Before re-inventing the wheel I figured I'd ask: I'm working on a tile-based 2d-maze level generator for cocos2d + box2d. The idea is: I'm using one of the well-known graph traversal algorithms to ...
-1
votes
2answers
725 views

Continuous Movement of gun bullet

I was using box2d for the movement of the body. When I apply gravity (0,0) the bullet continuously move but when I change gravity to the earth the behavior was changed. I also try to apply continuous ...
5
votes
1answer
2k views

How to apply impulse to a body to make it fly away?

I'm playing around with jbox2d and can't really make a body "fly away" as if from an explosion. From what I have found on the net, making the body fly away from the world center (0,0), should have ...
3
votes
2answers
1k views

Determinism in multiplayer simulation with Box2D, and single computer

I wrote a small test car driving multiplayer game with Box2D using TCP server-client communcations. I ran 1 instance of server.exe and 2 instance of client.exe on the same machine that I code and ...
2
votes
0answers
361 views

how to attach a body to a rope and making it swing to another rope

I've set some ropes (using cocos2d and box2d) and would like to attach a body to one rope in such a way that it can swing to another rope. I am not sure how to go about this. I read making and object ...