Questions tagged [jbox2d]

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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
39 views

Box2D & Processing - Collision location randomly assigned to center point

I am working on a particle simulation using Box2D with Processing. The setup: I generate 4 kinds of particles that exist in equal amounts (for instance 200 in total, 50 each). They are (for now) ...
wo_ste's user avatar
  • 11
1 vote
0 answers
48 views

Uniform lighting when there are multiple light sources

I'm writing a 2d game where there are walls and the NPCs can only see what is within their line of site. To do this I'm using Box2dLights so the walls create shadows. The problem I'm having is ...
Michael's user avatar
  • 121
3 votes
1 answer
271 views

How to detect a body between two points on LibGDX

I've two Vector2 (A and B), i draw a line between them. Is there a way to check if the line intersect the Box2D CircleShape? I need to a boolean output
WaltherEvans95's user avatar
2 votes
2 answers
634 views

How do I force a game object to move along projectile trajectory, like in Angry Birds?

I am a new Android game developer. I want to force my game object to move in a projectile trajectory, like in Angry Birds.Related example here and my example You can see an example in the image. I ...
user97543's user avatar
0 votes
2 answers
2k views

How can I easily render Box2D polygons with ShapeRenderer in LibGDX?

In the PolygonShape object, there is the method setAsBox() which allows for creating rectangles easily, but there is no ...
Andrew900460's user avatar
0 votes
1 answer
334 views

How to jump exactly X meters in Box2D World?

I want my character to always jump a constant height, let's say 3 meters. Also character has double jump ability so he can jump max 6 meters. For example, let's say I have pressed jump key while ...
clzola's user avatar
  • 133
0 votes
1 answer
101 views

Have body resume constant velocity after collision

I want to have a body move at a constant velocity, but react to collisions. My example game is a train, I want it to move at 1 meter a second. If an obstacle appears on the tracks, I want it to react ...
Rogerio's user avatar
1 vote
0 answers
35 views

Getting a TOISolver ArrayIndexOutOfBoundsException creating a tile based game

I've been making a tile-based game on java using jBox2D.For adding tiles to physical world I use static bodies which are stored in updating ArrayList(i use PhysicBlock class as a wrapper). Whenever I ...
Daniel's user avatar
  • 11
1 vote
1 answer
146 views

States within a GameState?

I ended up coming up with having states within game states. For example: States splash menu tracks garage loading play What bothers me is that I now have states within the play state to handle it ...
Danny Watts's user avatar
0 votes
1 answer
85 views

Box2d java contact point reference changes after collision

I am trying to hold the contacts made during a collision in an array list. After I add n amount of contacts, when I try to retrieve them later on, they point to the last contact made in the world. ...
Danny Watts's user avatar
1 vote
1 answer
87 views

Why is my Box2D Body only colliding with one type of Object after a new level has been built?

So developing for an android mobile game, using Android Studio and developing for the API 17, with Box2D implemented. FIRST LEVEL For some reason, one the first level everything is running okay: ...
101_son's user avatar
  • 66
-1 votes
1 answer
172 views

Collision problem JBox2D

I work with Processing and the JBox2D library and wanna code a new Ping Pong game. But if I move the player to the top border (or lower border), he collide on a wrong position. The picture shows ...
user67272's user avatar
2 votes
2 answers
4k views

LibGdx - Move sprite in the direction of other sprite

I'm kind new to LibGdx and I'm still learning. I'm working on a small game project to learn this nice framework. However, I'm having some issues with my game. My game is a top down shooter. There is a ...
Igor Lopes's user avatar
2 votes
1 answer
98 views

How to restrict jumping to a single jump?

I'm making a VolleyBall game in HTML5 with PandaJs GameEngine and plugin is used physics and Box2D. The problem is that players can jump, but they can jump over the net with multiple jumps. I have ...
7Game's user avatar
  • 21
0 votes
1 answer
404 views

Relative movement in Box2D (keep object from falling off planet)

I'm creating a game with planets orbiting around a sun, like this: The brown square is the earth, rotating around its center and around the sun. The yellow square is the sun, which doesn't move. Now ...
Ives's user avatar
  • 83
1 vote
1 answer
147 views

Permeable objects in Box2d

In Box2d, can I make a static object to be permeable by dynamic objects? Can I simulate something like water in a way that it lets rigid bodies to dive into it but at the same time pushes them off ...
src091's user avatar
  • 127
0 votes
1 answer
1k views

Set world boundaries in box2d

So far I've seen the only way to set boundaries on box2d world which is to create rectangular shapes and place them at the edges of the screen, is there any other ...
src091's user avatar
  • 127
3 votes
1 answer
912 views

Rotating towards a point in Box2D

I'm using Box2d as my physics engine and I'm trying to solve what would normally be a simple problem but what has become a nightmare for me and preventing me from finishing my app. (6 months work) I'...
Oliver Dixon's user avatar
2 votes
1 answer
2k views

LibGDX camera position shifted on movement

I'm programming a game with LibGDX and Box2D and I want my camera to follow my player. But as I zoom in (because Box2Ds metric system, using camera.zoom = x) the camera is shifted when the player ...
vigonotion's user avatar
1 vote
1 answer
594 views

Seeking Advice: Collision with JBox2d for Top-Down or Isometric Maps

I Hope I can make this as clear as possible! Currently working on an action RPG game, very early stages, more just the basic ideas down and written in. So i'll start on with my setup: Using Java ...
Josh Johnston's user avatar
2 votes
0 answers
234 views

Mouse click coordinates not mapping to Box2d world

I'm using Box2d in Java with OpenGL, trying to detect if a mouse has clicked on a Body. But having trouble mapping mouse coordinates to Box2d world. I have a ...
bobbyrne01's user avatar
3 votes
3 answers
2k views

Why do my Box2D bodies occasionally get stuck and separate forcibly?

I'm making a space game with LibGDX and Box2D. I made a video here to illustrate the issue. Verbal description: When objects collide, they sometimes get stuck together and are then suddenly separated ...
Snowdrama's user avatar
  • 203
1 vote
1 answer
816 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 posts/...
Xkynar's user avatar
  • 601
1 vote
1 answer
77 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 ...
null's user avatar
  • 143
3 votes
2 answers
152 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 ...
null's user avatar
  • 143
0 votes
1 answer
111 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 ...
Petter Thowsen's user avatar
1 vote
0 answers
33 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 ...
Petter Thowsen's user avatar
0 votes
1 answer
224 views

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

I´m following this tutorial: How do I use a JBox2D ContactListener to check if my character is standing on the ground? in order to get input from player's bottom part including a fixture in player's ...
Barbara PM's user avatar
0 votes
2 answers
1k 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 ...
Sujith's user avatar
  • 101
0 votes
1 answer
75 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?
user40647's user avatar
2 votes
1 answer
1k 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 ...
Luan Nico's user avatar
  • 157
0 votes
1 answer
62 views

Using texture() in combination with JBox2D

I'm getting some trouble using the texture() method inside beginShape()/endShape() clause. In the ...
Valentino Ru's user avatar
2 votes
1 answer
124 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 ...
Valentino Ru's user avatar
2 votes
1 answer
343 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 ...
andy's user avatar
  • 21
6 votes
1 answer
1k 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 ...
BleedObsidian's user avatar
1 vote
1 answer
235 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 ...
Brantley Blanchard's user avatar
2 votes
2 answers
2k 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 <...
Louis Hong's user avatar
2 votes
1 answer
2k 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 ...
emptyflash's user avatar
1 vote
0 answers
1k 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 (...
lase's user avatar
  • 530
0 votes
2 answers
934 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 ...
lase's user avatar
  • 530
1 vote
1 answer
490 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. ...
Siddharth's user avatar
  • 1,986
3 votes
3 answers
460 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 ...
Sean Connolly's user avatar
1 vote
1 answer
500 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.
Frederico Schardong's user avatar
0 votes
1 answer
962 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 ...
Miles's user avatar
  • 101
2 votes
2 answers
8k 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... ...
Jackie's user avatar
  • 445
1 vote
1 answer
393 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 ...
bengreenier's user avatar
6 votes
1 answer
5k 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 ...
Roger Travis's user avatar
0 votes
1 answer
772 views

JBox2D - how to get vertex positions?

I've created a triangle for jbox2d... ...
Roger Travis's user avatar
4 votes
3 answers
1k 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 ...
Amplify91's user avatar
  • 1,217