JBox2D is a java physics engine often used in games an other physics simulations, and is a port/extension of the C++ physics engine, Box2D.

learn more… | top users | synonyms

0
votes
1answer
41 views

“Running” against a steep slope on a Box2D Platformer

Ive seen alot of pages talking about how to emulate a platformer on Box2D, specially about how people dont want to slide down a slope. Well, my problem is different and Im surprised I cant find ...
0
votes
0answers
27 views

Correctly identifying a Fixture from an extended class in Box2D's ContactListener

Sorry for the confusing title, I dont know how to resume it that much. Im making a game, and I have a simple class Mob which is extended by Warrior and Enemy. A Mob has a Body, and that body usually ...
1
vote
1answer
26 views

In JBox2D, where is the correct place to interact with Body objects? step() method?

QUESTION: In an application, where is the appropriate place to put the code to interact with the Body objects? By 'interact' I mean Get position Determine actions Apply impulse Would it be ...
1
vote
1answer
36 views

In JBox2d when dragging a Body, why is the direction is flipped vertically?

Why is it when I drag a JBox2d Body with the mouse, the vertical component is flipped? e.g. If I drag down-right, the Body moves up-right. Is this expected behaviour, a bug in JBox2D, a Mac ...
0
votes
0answers
21 views

Drawing jbox2d shapes in slick2d

How would be the best way to go about drawing polygons in slick after forces where applied to them via jbox2d? There seems to be no way to get the vertices of a body defined in jbox2d...
0
votes
0answers
53 views

Box2D and randomly generated tilemaps

I am making a 2D Terraria-style sidescrolling game. I want to use box2d for the physics. However, I am using tilemaps for the maps, and I do not know of a processor-efficient way to use Box2D bodies ...
0
votes
1answer
63 views

JBox2D bodies don't collide?

I have two objects. A dynamic player and a static ground object. It was working for a while until I did some refactoring and suddenly my play falls right through my ground object. Is there anything ...
0
votes
0answers
21 views

How can I avoid duplication of jBox2D physics attributes?

I'm using jBox2D for physics and collision detection in a game engine with an entity-component system. It works, but I'm unsure how to structure my code with respect to the values represented in the ...
0
votes
0answers
35 views

GWT problem with Box2D WheelJoint

I am using the below libgdx java code for a wheel joint and rear axle using Box2D. This works fine for android, Desktop, but when I attempt to run through GWT I get the following error. at ...
0
votes
1answer
77 views

How do I create a Fixture in Andengine and assign it user data?

I´m following this tutorial: How do I use ContactListener in JBOX2D? in order to get input from player's bottom part including a fixture in player's main body. My problem is that I´m initializing ...
0
votes
0answers
44 views

Apply impulse to ball to a fixed height Jbox2D android

I have to hit a ball to a fixed height repeatedly as shown in the following image. This game is similar to 1983 Hitit The difference is the hitting y axis will be variable. I wanted to hit the ...
0
votes
2answers
148 views

Box2d world width and height ratio with screen width and height

I have view, for example GameView which extends SurfaceView . I have integrated Box2D physics in GameView. I have two widths , GameView width, height and Box2D physics world width ,height. I need to ...
0
votes
1answer
23 views

How do I get the position of a static body in Jbox2D?

I'm trying to get the position of a static body in JBox2D, how do I do that?
2
votes
1answer
284 views

libgdx default saving mechanism for box2d world

I want to save my game in libgdx, and I have no problem using Kryo to save everything, except the box2d Worlds and the RayHandlers from box2dlights - these are not Serializable and do not have default ...
0
votes
0answers
7 views

Can't find PolygonDef in JBox2D [duplicate]

I was just following along with a tutorial on youtube and suddenly I couldn't import something named PolygonDef, just something named PolygonShape. I tried to finish the tutorial with the PolygonShape ...
0
votes
1answer
35 views

Using texture() in combination with JBox2D

I'm getting some trouble using the texture() method inside beginShape()/endShape() clause. In the display()-method of my class TowerElement (a bar which is DYNAMIC), I draw the object like ...
1
vote
1answer
93 views

Box2D relations

As far as I know, the unit in Box2D is meters. When I use Box2D in Processing with JBox2D, I set the "world size" as the window size specified in the setup(). Now I'm wondering if there is any ...
2
votes
1answer
157 views

JBox2D Polygon Collisions Acting Strange

I have been playing around with JBox2D and Slick2D and made a little demo with a ground object, a box object, and two different polygons. The problem I am facing is that the collision-detection for ...
6
votes
1answer
315 views

2D Polygon Triangulation

I am creating a game engine using the JBox2D physics engine. It only allows you to create polygon fixtures up to 8 vertices, To create a body with more than 8 vertices, you need to create multiple ...
1
vote
1answer
72 views

Which .jar has JBox2d's p5 package?

Using Eclipse, I'm trying to write a simple hello world program in processing that simply draws a rectangle on the screen then has gravity drop it as seen in this tutorial. The problem is that when ...
2
votes
1answer
291 views

How do I use a JBox2D ContactListener to check if my character is standing on the ground?

I want to know when my character is touching a wall or floor. I've had no luck searching for information on this. I saw a few things about ContactListeners and getContactList(), but I don't understand ...
2
votes
1answer
321 views

Camera scrolling and game boundaries

I am making a platformer game in JBox2D and LWJGL that has a scrolling camera, but I have hit a wall with the boundaries of the camera. Essentially what I have right now is a Box2D world that is ...
1
vote
0answers
367 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
471 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
310 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 { ...
3
votes
3answers
229 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 ...
1
vote
1answer
359 views

2D js physics engine for HTML4

Is there any engine for Javascript like box2dweb that does not use Canvas? I need to build a game that works in HTML4 browsers.
0
votes
1answer
500 views

Box2D and Slick2D: Graphics bug [closed]

The bug The physics ground represented by a horizontal line. The object is stationary, and seems to be pretending that the ground is lower. This is because the center of the Shape is incorrectly ...
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 ...
1
vote
1answer
198 views

OutOfBounds Exception when creating a PolygonShape using jbox2d

So here's the deal, i'm parsing a file that contains the vertices for a polygon, that i want to create in box2d. I create a new PolygonShape() and then call .set() giving it a defined array of Vec, ...
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 ...
0
votes
1answer
420 views

JBox2D - how to get vertex positions?

I've created a triangle for jbox2d... public void createTri(){ PolygonDef shape = new PolygonDef(); shape.density = 2.0f; shape.friction = 0.8f; shape.restitution = 0.3f; ...
3
votes
3answers
592 views

Why does creating dynamic bodies in JBox2D freeze my app?

My game hangs/freezes when I create dynamic bullet objects with Box2D and I don't know why. I am making a game where the main character can shoot bullets by the user tapping on the screen. Each touch ...