Box2D is an open-source rigid-body 2D physics simulation library for games, written in C++.
50
votes
5answers
14k views
Good 2D Platformer Physics
I have a basic character controller set up for a 2D platformer with Box2D, and I'm starting to tweak it to try to make it feel good. Physics engines have a lot of knobs to tweak, and it's not clear to ...
15
votes
4answers
3k views
Best strategy (tried and tested) for using Box2D in a real-time multiplayer game?
I am currently tackling real-time multiplayer physics updates for a game engine I am writing. My question is how best to use Box2D for networked physics. If I run the simulation on the server, should ...
14
votes
6answers
4k views
Are there any alternative JS ports of Box2D?
I have been thinking about creating a top down 2D car game for HTML5. For my first game I wrote the physics and collisions my self but for this one I would like to use some ready made library.
I ...
11
votes
5answers
2k views
2D Rope Collision Detection
I'm wanting to create a rope that can collide with objects like in the following youtube video:
2D Game Physics Rope
I'm thinking that you implement the verlet integration which uses points and ...
10
votes
1answer
1k views
Should I write my own physics engine, because of networking integration?
I'm currently developing a top down, realtime, zombie shooter. I'm coding this in Java, using JBox2D as my physics engine. I have been coding the networking this week, and am now up to the physics ...
10
votes
2answers
3k views
Making a character move along a curved slope in a World with gravity
I have seen this game
Fancy Pants 2 . And the thing I noticed apart from the physics and beautiful animations is that the character is moving along slopes , even curved slopes. I have little ...
9
votes
1answer
2k views
Box2D Get Bounding Box of a Body
In Box2D, I was curious if it's possible to get a bounding box of a body already created in the world.
So basically, the Body is created, it's interacting with the world and such. And I needed that ...
8
votes
3answers
2k views
How do you do AI path following within a 2d physics engine like farseer/box2d?
I'm in the process of moving a 2d top down game I've been working on into a proper rigid body physics engine like Farseer. Up until now, I had just hacked together my own physics code where needed.
...
7
votes
6answers
595 views
Physics library internals
I've seen box2d and bullet ports into javascript, but neither of them attracted me particularly, except by source code.
It all seemed, after all, quite simple once I looked inside them. But what are ...
7
votes
6answers
360 views
Determining player.isFalling() through change of y?
I'm currently using Box2D and my character is a bunch of fixtures in Box2D. I was wondering if, to determine if a player is falling, detecting a change in Y position would be appropriate?
Are there ...
7
votes
1answer
2k views
Basic Box2D collision detection
I don't understand how to listen for collisions in Cocos2D/Box2D. Say I have two dynamic circle bodies. One is very small and the other is relatively large. When the small circle collides w/ the ...
7
votes
3answers
931 views
How to implement 2d explosions that will cause damage taking into account covers and distance?
How can I implement a 2D explosion in a way that it will cause less damage to characters that hide behind crates or other cover? Ideally damage will depend on the strength of the cover (e.g. metal ...
7
votes
2answers
1k views
Box 2D Set Origin
I'm trying to set the origin of a box2d shape. By default, a shape rotates around the center. But I'm trying to get it to rotate around the left of the shape. Like a clock for example.
I've heard of ...
7
votes
1answer
378 views
How can I copy or back-calculate definitions for an entire b2World?
I'm working on a platformer where I'd like to be able to move or copy bodies between multiple Box2D b2Worlds. The desire has cropped up three times now - moving objects between documents in my editor, ...
6
votes
4answers
1k 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, ...
6
votes
4answers
2k views
Implementing top view physics using box2D
How can top view physics games be done in box2D? One idea I have is to set the linear velocity of an object manually or to alter the linear and angular damping as my object moves over different ...
6
votes
1answer
1k views
What causes Box2D revolute joints to separate?
I have created a rag doll using dynamic bodies (rectangles) and simple revolute joints (with lower and upper angles). When my rag doll hits the ground (which is a static body) the bodies seem to ...
6
votes
0answers
119 views
How do I get the compression on specific dynamic body
Sorry, I could not find any tag that would suit my question.
Let me first show you the image and then write what I want to do:
I'm using box2D. As you can see there are three dynamic bodies ...
5
votes
2answers
2k views
Is it worth it to use Bullet for 2D physics instead of Box2D for the sake of learning Bullet?
There isn't much more to the question. I'm not concerned about overhead, as I'm sure they are both fine for my purposes. Basically, I am familiar with Box2D concepts because of the Farseer Physics ...
5
votes
4answers
379 views
Making a Box2D ball bounce to constant height
I want to create a game like Doodle Jump. I'm using libgdx and Box2d. I needadvice on how to make my ball bounce constantly and with the same height.
I've tried setting the ball's body restitution ...
5
votes
4answers
870 views
How to port a game from IPad to Iphone
I just finished developing a 2D side scroll game for the IPad using Cocos2d and Box2d.
Now we want to make an IPhone 4 version of the game, but I'm still not sure what is the best way to do it.
I ...
5
votes
1answer
207 views
Rectangles render with gaps in between them (Box2D)
Right now I create my boxes where 1 meter is 85 pixels. Gravity is 10. And
fixtureDef.restitution = 0.1f;
fixtureDef.friction = 0.5f;
...
5
votes
2answers
1k views
cocos2d Merging box2d bodies
i'm using cocos2d to build an iphone game.
my game currently has two sprites: one for the main character and another for an item i should carry once he gets on him.
the main character and the item ...
5
votes
1answer
717 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 ...
5
votes
1answer
1k views
Box2D Difference Between WorldCenter and Position
So this problem has been brothering for a couple of days now. First off, what is the difference between say Body.getWorldCenter() and Body.getPosition(). I heard that WorldCenter might have to do ...
5
votes
1answer
524 views
How to create multiple balloon bodies in Box2D?
In Box2D, how would I go about making a body that's being lifted by multiple "balloons"? These balloons would have to be able to be destroyed (for example, by a bow and arrow).
5
votes
2answers
2k views
How to make bird to fly using box2d
I am new to Box2D, I have set gravity to 10. How to make an object fly in space even though the gravity is 10. What are the properties I need to set to make object fly? Is there any different ...
5
votes
2answers
3k views
Using The Box2D Polygon “Set()” function?
I'm using the Box2D physics engine. And there's a type of shape for box2D called b2PolygonShape.
In this class, you can create polygons. There is also a Set() function that takes an array of points ...
5
votes
3answers
3k views
Box2D Check If Point Intersects a Body
Is there a way to check if a point is intersecting a body?
For example, lets say there's a body in the world at a position of (100,100).
Is there a way to check if a point at (100,100) intersects ...
5
votes
3answers
4k views
Polygon/Shape definition changes in Box2D 2.1
I was going through a pretty good tutorial on Box2D here, but I ran into a problem when he made a b2PolygonDef, because the tutorials were made in 2.0, and I'm using 2.1. I could download 2.0 I guess, ...
5
votes
3answers
127 views
What could cause a sudden stop in Box2D?
I'm using Box2d for a game, and I have a bug that's driving me nuts. I've simplified the situation down to a square player sliding back and forth frictionlessly on top of a floor composed of a series ...
5
votes
1answer
447 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 ...
5
votes
2answers
2k views
Physics or Time-Based Animation In Corona SDK (iOS) Using Box2D
I am part way through creating a Doodle Jump clone for iOS using Corona SDK. I'm currently using the physics engine (box 2D). It's not a straight clone, but I need the basic principles in place to ...
5
votes
3answers
4k views
How to remove a box2d body when collision happens?
I’m still new to java and android programming and I am having so much trouble Removing an object when collision happens.
I looked around the web and found that I should never handle removing BOX2D ...
5
votes
1answer
428 views
Strangeness when simulating a chain
I'm using box2d and I simply hook up 10 points each with a similar length constraint to the adjacent point.
When I move 1 point, the others follow just like a rope/chain. Just like one would expect.
...
5
votes
1answer
361 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
...
5
votes
1answer
644 views
Scrolling Box2D DebugDraw
I'm developing a game using Box2D (javascript implementation - Box2DWeb), and I would like to know how I can pan the debug draw. I know the usual answer is - don't use debug draw, it's just for ...
4
votes
2answers
207 views
Detecting a ledge in Box2D [duplicate]
Possible Duplicate:
Detect Open Space in Farseer
How do I detect ledges?
I'm making a 2D platformer with Box2D. The player needs to be able to grab onto a ledge and pull him/herself up.
...
4
votes
1answer
558 views
How to make an object fly out of a slingshot?
At the moment I'm improvising a slingshot, the user can click and drag the projectile and let go.
The force on the object is calculated by getting the distance between the vector of the slingshots two ...
4
votes
2answers
1k views
Box2D Raycast - Getting position / angle of edge hit
I'm casting a ray in Box2D using b2World.rayCast how can I get the normal of the wall which was hit? Or better yet - the line start and end points?
The information returned is:
Fixture (fixture hit, ...
4
votes
3answers
1k views
Box2D networking
I am trying to make a simple sync between two box2d rooms, where you can drag boxes using the mouse.
So every time player clicks (and holds the mousedown) a box, I try send joint parameters to ...
4
votes
3answers
541 views
What do I need to change in Box2D to work in pixels?
Box2D seems to be set up in such a way that you cannot work in pixels (i.e. physics scale = 1). It produces very strange results as it hits maximum speed limits at low speeds and looks very strange. ...
4
votes
3answers
2k 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 ...
4
votes
1answer
458 views
Issues with Polygon Fixtures in Farseer
I've been working with the Farseer Physics Engine to try and build a simple 2D, sidescrolling game. Creating basic rectangle blocks worked easily enough, but I discovered when I tried to create some ...
4
votes
1answer
88 views
How to detect whether an Object came to sleep at a specific position?
I'm currently writing a small game with box2dweb and I need some direction for this: I'm throwing a Box and have to hit a specific place and trigger an event when the object that's been thrown isn't ...
4
votes
3answers
535 views
IndexOutOfRangeException on World.Step after enabling/disabling a Farseer physics body?
Earlier, I posted a question asking how to swap fixtures on the fly in a 2D side-scroller using Farseer Physics Engine. The ultimate goal being that the player's physical body changes when the player ...
4
votes
2answers
1k views
How to create simple physics for a group of balloons colliding in the screen (2D)
The game is 2D, how can I make simple physics for a group of balloons colliding in the screen.
What I need is the balloons not to overlap and to bounce when they reach the limits of the screen or ...
4
votes
2answers
876 views
How to create an extensible rope in Box2D?
Let's say I'm trying to create a ninja lowering himself down a rope, or pulling himself back up, all whilst he might be swinging from side to side or hit by objects. Basically like ...
4
votes
4answers
1k views
Make player to always move along the terrain
I'm working on a 2D platformer side scroller game. I am giving high impulse to player, the player starts moving and if it hits a slope on terrain, it gets a vertical movement and starts to fly over ...
4
votes
1answer
324 views
Mario like jumping and landing in box2d, help
I've been trying to get Mario type jumping/landing in a Box2d game and it's been giving me some trouble.
Results: Player loses velocity on landing
Desired Results: When player lands it will continue ...


