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

learn more… | top users | synonyms

1
vote
1answer
117 views

Cocos2D: Box2D body that is movable by one type of object but not another

I'm in the process of creating a simple platform game using Cocos2D 2.0 and Box2D. I'm trying to create a kind of crate object that cannot be moved by the player, but that can be moved by an elephant ...
2
votes
1answer
315 views

Box2D: Asteroids-Like Spaceship Physics

I'm new to Box2D (JavaScript) (and the world of physics/mathematics) so I'm having a hard time working out the methods I need to use to make a spaceship act like it does in the classic arcade game ...
0
votes
1answer
469 views

Box2d contant speed before and after collision

I want to make my body fly at constant speed, how to make it fly at constant speed before and after collision? I set restitution of my body to 1.0 but after some direct and powerful collisions my ...
4
votes
1answer
356 views

Box2D Joints in entity components system

I search a way to have Box2D joints in an entity component system, here is what i found : 1) Having the joints in Box2D/Body component as parameters, we have a joint array with an ID by joint and ...
3
votes
0answers
133 views

How to make the Angry Birds “shot arch” dotted line? [duplicate]

I am making a game that includes 2D projectile flight paths like that of Angry Birds. Angry Birds employs the notion that a previous shot is shown with a dotted line "arch" showing the player where ...
3
votes
1answer
353 views

How to implement server side physics?

I am working on 2-player 2d sidescroller. How should I implement the physics on the server? Use one world for every game or use a big world in which I add every 2 player that start a game? I have ...
2
votes
1answer
180 views

Using Box2D for range detection?

I have two entities. One has a sword, one has a bow and arrow. When the bow entity is 100 units away, he needs to begin attacking. Likewise, when the sword entity is 10 units away, he needs to begin ...
-2
votes
1answer
103 views

Language & framework for fast prototyping Box2d problems [closed]

I am often in need of a fast prototype box2d scene where I can play with parameters. I work with AndEngine on Android which doesn't suit me for prototyping. It's good for the final game, but ...
-3
votes
1answer
304 views

How do I change gravity of box2d world after world is created?

I want to modify the world of box2d after creating it, namely to change the gravity vector. Is there a way to do this?
2
votes
2answers
112 views

AndEngine: edit elasticity on action

I'm making a game for Android with AndEngine. It's going quite well, but now I'm stuck on something. My main character has a elasticity set in its fixturedef so it bounces around throughout the ...
4
votes
1answer
799 views

Problem Implementing Texture on Libgdx Mesh of Randomized Terrain

I'm having problems understanding how to apply a texture to a non-rectangular object. The following code creates textures such as this: from the debug renderer I think I've got the physical shape ...
6
votes
1answer
887 views

Generating a physics body for 2D Worms-like Terrain

I wrote a processing sketch that generates hills for a scorched earth clone, like this: I'm trying to figure out how to make this a physics object in libgdx, but I'm having problems figuring out ...
0
votes
1answer
275 views

Moving a Box2D object in the direction it is facing using applyForce [duplicate]

I'm trying to apply force to a polygon physics object to move it. Whilst I can get it to move upwards easily enough, I'm trying to get it to move in the direction in which it is pointing. Here's my ...
1
vote
1answer
90 views

Ring and Pole - Box2d

How I can make a b2Body in box2d so that it could form a ring which does not collide from the center just like a ring. like when we flick the object and there's another body (like pole), the pole can ...
7
votes
1answer
749 views

How to simulate feather fall in box2d?

I am working with AndEngine with Box2d extension, but general answer or a concept idea will be appreciated too. I have feather-like objects in a 2D side view world that I want to be part of the ...
4
votes
2answers
357 views

2.5d with box2d - approaches from the top and bottom

So, I'm using box2d for my 2.5d game (think double dragon, tmnt arcade, castle crashers) where you can move around on the z-axis (faked as y-axis movement). Basically, I have box2d only doing ...
1
vote
1answer
362 views

Hill-jumping game mechanic like Tiny Wings

I'm a huge Tiny Wings fan and I'd like to understand the game mechanic at a deeper level. What are some good resources for the basic Box2d (or similar) physics behind the hill-jumping game mechanic? ...
2
votes
2answers
199 views

Client-side physics simulation

I am trying to create a very simple client-server based physics game, using box2d library. A simple football game. Obviously, the server runs only the box2d world. My question is: is it correct to ...
2
votes
1answer
329 views

Separation algorithm in flock simulation?

I'm using box2d (the c++ one). I found a method for an arriving behavior (on http://www.red3d.com/cwr/steer/gdc99/ ), which works well, problem is, the bodies are bumping into each other and it ...
0
votes
1answer
298 views

Is there a “box2d without physics” lib (only for collision detection)?

Box2d Collision detection algorithms are probably the best ones out there. Unfortunately, they are bundled together with a realistic physics engine that I don't need. Is there an open source project ...
1
vote
1answer
155 views

Bodies do not stay sticked together by joint in retina display

I'm rehearsing on Box2D revolute joints. Everything's going pretty well except for one thing. For some reason bodies joined together with revolute joints do not stay sticked, they start getting apart ...
3
votes
1answer
317 views

How do I copy box2d data from one body to another?

I want to copy all Box2D-related data (position, velocity, rotation, impulse, ...) from one body to another. This is what I've got working (with box2djsweb): var t = body.GetTransform(); ...
0
votes
1answer
510 views

Why might a body suddenly stop while moving on continue platform?

I have a 32x32 sprite and I make some to be platform like this for (int i = 0; i < 15; i++) { attachChild(new Ground(32 * i, 200, regPlatform, vertexBufferObjectManager, physicsWorld)); } ...
1
vote
1answer
662 views

Is using Box2D for simulating gravity “in space” a good idea? [duplicate]

I'm attempting to write a simulation of a solar system of planets in 2D space that are attracted to each other through Newton's law of universal gravitation. I know that it is possible to simulate ...
0
votes
0answers
273 views

Slow Rope Joint Simulation

I am right now developing game similar to Cut The Rope. But I have some problem in developing this game. I have successfully created rope and attached multiple rope with candy. Below I represent ...
0
votes
1answer
190 views

Box2D OpenGL debug renderer convert box2d coordinates to world space

I made an OpenGL 3.x renderer for Box2D's debug draw (b2Draw base class). Unfortunately I've tried for a while now to convert the box2D units, which are meters to my internal units which are pixels. I ...
1
vote
2answers
417 views

Making the player walk on walls in box2d

I'm making a game in stencil where players walk form left to right along randomly generated walls. I cant use waypoints, since the walls' shapes and positions are unpredictable. Here's a descriptive ...
2
votes
1answer
142 views

Is it bad practice to set the velocity of an object every loop?

Say I have a simple game with a gameLoop function that gets called every 50 milliseconds or something similar, and I have a box2d object. Is it bad practice/too CPU intensive to use SetLinearVelocity ...
3
votes
1answer
563 views

AndEngine; Box2D - high speed body overlapping, prismatic joints

I'm trying to make good suspension for my car game, but I'm getting nervous of some problems with it. At the beginning, I've tried to make it out of one prismatic joint/revolute joint per one wheel ...
1
vote
1answer
611 views

Libgdx import bin/xml/json from physics editor

I'm using Libgdx. I did a simple json file in Physics Body Editor and I don't have any idea how could I import it into my physic world in libgdx. Any idea will be appreciated. P.S: Sorry if there ...
3
votes
3answers
385 views

Libgdx body passing through block then fall on it

I'm using libgdx and its physic engine Box2d. My question is : how could I make my box2d body go through a block , ignore the first collison than make the block active so the ball can fall onto it. A ...
4
votes
1answer
601 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 ...
0
votes
1answer
419 views

Rotate Box Sprite With Circle Body

I want to rotate my rectangular sprite with circle body. The problem is the body doest not attached to the centre of the sprite. This was the default behaviour of the body and sprite. But I want that ...
1
vote
0answers
323 views

Why won't my Box2d bodies collide? [closed]

I'm doing something wrong when trying to get bodies to collide using jBox2d & Slick2d. Here is have just my basic init, update, and render methods. Render and update seem to work fine for drawing ...
0
votes
2answers
372 views

Increasing speed of circle over time as linear with Box2d

Assume that there is a circle and it can be moved by using keyboard arrows.Is required that increasing speed over time like increasing car speed. For example; max speed is 25 and time to reach max ...
4
votes
1answer
674 views

How would I make an air hockey AI?

I am making an air hockey game for Android using AndEngine and its Box2D extension. How would I make an AI for an air hockey game? For it to work the AI would not only need to move its paddle side ...
7
votes
4answers
1k 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 ...
8
votes
1answer
273 views

In Box2D, how can I get the compression force on a specific body?

I'm using Box2D. As you can see, there are three dynamic bodies connected to each other (think of it as a table from front view). LEG1 and LEG2 are connected to the static body (it's the ground ...
0
votes
2answers
420 views

How to translate from Slick2d coordinates to jBox2d

I read through this question to try and get a grasp on the topic, but I can't figure out how to apply this to my Slick2d window. I'm trying to do something as simple as place an edge on the bottom of ...
1
vote
1answer
280 views

Debug Render In Cocos2d Android

I want to implement debug render for cocos2d android.So I can view how bodies are created. Right now I use gdx.jar file for box2d and load that jar file following way. static { ...
0
votes
2answers
145 views

Problem with sensor in box2d [closed]

I have two bodies: one green static sensor (spikes) and one orange dynamic body (brick). I have bullet and it's a dynamic body too, but with bullet flag set. My problem is that when the bullet is ...
0
votes
1answer
872 views

JBox2D simple example for Android? [closed]

I'm starting to develop an Android game. I've already installed jBox2D but I can't find complete code to develop a simple application from scratch using this framework. Thanks in advance!
1
vote
2answers
365 views

What to use as a Box2D renderer in a release version?

I'm creating a game with libgdx. For testing physics I use a Box2DDebugRenderer, which is not fast. When I want to release my full game, what should I use as a renderer?
1
vote
0answers
961 views

Why do restitution values less than one still cause infinite bouncing in Box2D?

I'm currently trying to implement basketball bouncing into my game using Box2d (jBox2d technically), but I'm a bit confused about restitution. While trying to create the ball in the testbed first, ...
0
votes
1answer
774 views

Ligdx Box2d : convert box2d coordinates into screen coordinates

I'm new in libgdx and i have a little problem. I created a body in box2d and i want to assign it a sprite; for that i need to get the position of the body,then insert into the main loop the updated ...
1
vote
3answers
2k views

What is the Box2D coordinates system?

I know that for Box2d I need to translate pixels to meters which is easy peasy. However my problem is what is the orientation of Box2D coordinates system? Is this the same as screen one (right += x, ...
3
votes
3answers
223 views

Box2D - Do these simple objects need to be in the simulation?

I would like to get input from the community regarding how best to represent simple objects in a Box2D based simulation. Some background: Without going into too much detail, think of a top down game ...
4
votes
1answer
492 views

Collision Filtering in Box2D

I have four bodies in my Box2D World. Each are polygon shape, with some physics parameters. Now when the game start, I need one of the bodies from the World (BodyA) to not be allowed to collide with ...
2
votes
1answer
71 views

Accessing other classes from a Box2D (farseer) body

I'm using Farseer for physics in a game, and have several key classes: Planet and PlanetProp. Each planet has a large circular body and a "field". This field is a large sensor around the body. ...
2
votes
1answer
122 views

Efficiently storing game states history for physics?

I would like to store the history of a box2d simulation. Currently I can't find any built-in mechanism for that. I need to store the states of all non static objects in the last second, mainly for ...