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

learn more… | top users | synonyms

0
votes
1answer
217 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
469 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
680 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 ...
2
votes
1answer
723 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
436 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
642 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
491 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
381 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
407 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
746 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
282 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
492 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
318 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
155 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
942 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!
2
votes
2answers
446 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
1k 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
871 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
232 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
604 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
76 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
124 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 ...
0
votes
1answer
156 views

Making a physics body so that another body passes through

Basically I "think" I want a static body that does not have any density so another body can "pass through it" without getting slowed down. I tried this and it doesn't seem to work. What would be the ...
-1
votes
1answer
219 views

Parallax With Box2d iphone

I am creating the simple game. In that game car will move and obstacles will come in the car way we will have to save that car from that obstacles. What I have done. I have created the car with the ...
-1
votes
1answer
1k views

Create Box2D and engine polygon Box2D body without sprite

Hey I have created my body using following code: (please read full description) Body polyBody; final BodyDef mBodyDef = new BodyDef(); mBodyDef.type = BodyDef.BodyType.DynamicBody; ...
3
votes
1answer
2k views

Getting Bodies to go “Super Fast” in Box2D

I am making a breakout game in Android using the LibGDX version of Box2D. I have a ball that I am applying a force to with the following code... getBody().applyForceToCenter(-10000000000.0f, ...
5
votes
1answer
666 views

box2d with lines

I have a very simple platform game builder and I've specified the ceilings, walls and floor as line segments. A line has a winding, or normal; you can determine the direction that a line should be ...
1
vote
1answer
2k views

How to create Elastic rope / Rubber band in box2d?

I am trying to create the rubber band type or elastic rope. i ant to do something like bellow link. http://heyalda.com/smash-turtle/ Thanks,
2
votes
2answers
900 views

Non-physics character movement in a Box2d Environment

I am in the process of creating a physics platformer. However, I want the player movement to feel very old-school(as in: non-physics like), which means that the character: Should always move equally ...
1
vote
1answer
108 views

Best way to have a body with 1 dimensional linear only movement in Box2D

I have a body that I am using as a paddle, it is expected to move in a vertical fashion and other objects should "bounce off it". The paddle itself should never move horizontally. According to the ...
-1
votes
1answer
109 views

How to create strength meter?

I am creating game like bow and arrow. I want my hero will shoot the arrow with the strength meter, how will create the power?
1
vote
2answers
1k views

Moving player in Box2d without forces

How do I move player with keyboard without applying forces? If I do playerBody.setLinearVelocity(new B2Vec2(0, 2)) it moves the player but when I release the key for movement, the ball is continuously ...
2
votes
1answer
1k views

Stopping on a slope in Box2d

I am creating a simple platformer using Box2d. I've implemented a variant of the technique described here. To make the player character move more 'platformer-like' I want him to stop on (shallow) ...
1
vote
1answer
174 views

How to handle sprite speed when objects move using Box2d?

I have a basic platformer using Box2d that works great. However, I now want to stop using my default square, and implement some running and jumping animations. How can I ensure that: When running, ...
4
votes
3answers
3k views

Box 2d Level Editor for AndEngine

I am getting started with Box2d in AndEngine. I need to know if there is any level editor to be used with box2d and gives output capatable with AndEngine. Is there any tool which can help me building ...
2
votes
1answer
510 views

How to make a character in a Box2D world jump faster?

I have a question about using Box2D to simulate a physics-platformer. I manage to make the character move to the right and left, and jumping as well. However, jumping seems extremely slow when ...
2
votes
1answer
258 views

Best way to allow a user to Control Body in Box2D

I am working on a simple game and I am deciding how I should let users interact with the world. I really have 2 options, 1.) When the user moves an object I apply a force to the body 2.) With each ...
2
votes
2answers
1k views

How do I get the touch event on a body in Box2d(Java)

I have various bodies rotated at some angle with the help of Box2d in libGDX. What I want is to destroy the body when I click on it, but the problem is that I am not able to get the area definition of ...
1
vote
2answers
2k views

Applying Forces to Box2D Bodies

In full disclosure, I am VERY new to box2D let alone the Java version of it. I have a box (here of type Hero) that I am trying to move. I did this by trying to apply a force as follows... private ...
5
votes
3answers
259 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 ...
4
votes
1answer
263 views

Letting the user draw a Polygon Body and Image

In my game, I want to provide the user with a drawing feature. By free hand drawing, the user creates a polygon shape. Then, in my game implementation, I have to create a body for the found vertices ...
2
votes
2answers
963 views

Error in destroying object in Box2D/LibGDX

I'm trying to delete an object when a collision happens. I have put the following code in the render method of the object so it would be outside of the physics calculations. public void ...
0
votes
1answer
107 views

Questions for QueryAABB

I'm currently having trouble getting my head around QueryAABB, and hope to find some answers here. The LowerBound of an AABB the upper-left corner (and vice versa). Why is that and what idea is ...
4
votes
1answer
112 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 ...
0
votes
1answer
161 views

How to get the Exact Collision Point and ignore the collision (from 2 “ghost bodies”)

I have a very basic problem with Box2D. For a arenatype game where you can throw scriptable "missiles" at other players I decided to use Box2D for the collision detection between the players and the ...
-1
votes
2answers
290 views

Single and Double Jump with single button.

I want to make Single Jump on Single Tap and Double Jump on Double Tap. My problem is that if I make double Tap on ground then it’s fine but if I make first Tap on ground and second Tap in Air then ...
1
vote
0answers
170 views

Flick Kick like game with box2d and flash as3 [closed]

What would be the best approach for creating a game like flick kick with box2d and AS3?. To make my self more clear, what i would like to do is to use the physics of box2d in the z-axis, i know that ...