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.

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

Questions

Questions with the jbox2d tag should be specifically about JBox2D and its implementation. Questions about the physics engine in general should be tagged with box2d as well.

Brief Definitions

  • World contains the physics environment for a simulation
  • Body is a physics entity with any number of child fixtures. These fixtures are treated as all part of the same physics object, and will interact accordingly (they won't break up). Bodies also provide support for user-applied forces and torque.
  • Fixture contains a single shape and information about it (for example, friction and restitution).
  • Shape contains information about the basic physical properties of the physics object. (for example, the vertices of the polygon shape)
  • Joint is basically a way of adding constraints to different bodies. There are a variety of joints, including revolute, distance, and prismatic joints.

Links

JBox2D

Box2D

183 questions
1
vote
1 answer

Box2D: Rope pendulum (no stop)

I would like to make a scene where there is a "pendulum" that oscillates continuously, no stop. I have uploaded an image for better clarity. So i try to use Box2D joints. For example: RevoluteJointDef revDef = new RevoluteJointDef(); …
fpellegrino
  • 149
  • 1
  • 2
  • 12
1
vote
1 answer

How do I get JBox2d Body size

I can easily get the position of the body but assuming it is a box, how do I determine the coordinates of the box so I can display it? Just to get it to display, I hard-coded it to a 10 x 10 but if I'm drawing a wall, it should be tall while a…
Brantley Blanchard
  • 1,208
  • 3
  • 14
  • 23
1
vote
2 answers

How do I serialize a JBox2d World object?

I have a server that has several clients connecting. Each client has one body (player) that they can control but there can be collision therefore they will need to see everyone else's body to know why some of their movement is restricted. My…
Brantley Blanchard
  • 1,208
  • 3
  • 14
  • 23
1
vote
1 answer

Processing / box2d - using setTransform() to set position of object not working as expected

I'm making a 2d game using processing and box2d. In my game I have an object targetBox that is an instance of Box. On game start targetBox appears and rests on a see-saw. The goal of the game is to use a sling shot to fire other boxes at the see-saw…
MattSull
  • 5,514
  • 5
  • 46
  • 68
1
vote
1 answer

box2d gravity player fall down faster

I'm developing game with box2d for mobile.I created a world by these codes: b2Vec2 gravity(0.0f, 9.8f); bool doSleep = false; b2World* g_World = new b2World(gravity, doSleep); it's working so good.I have player object.The player fall down…
user1391058
  • 265
  • 4
  • 19
1
vote
3 answers

How to rotate multiple objects properly in Java?

I have an Arraylist with objects that contains the position and rotation of an object which i want to draw on screen using Graphics2D. public void render(Graphics g1) { Graphics2D g = (Graphics2D) g1; g.setColor(Color.white); for(PhysicObject object…
user1734282
  • 388
  • 2
  • 4
  • 17
1
vote
2 answers

Using android box 2d in my android project

I am trying to find the .jar file for android box 2d but haven't been successful. So far I've found an apk supposedly with it but don't know how i'd use that. Supposedly you can convert the apk to a jar, but is that what i'm looking for? A…
Tom Prats
  • 7,364
  • 9
  • 47
  • 77
0
votes
1 answer

Can't Create Static Object in Box2D

Well, more specifically, JBox2D. I have a circle falling down, and when clicked on, the circle becomes a box and becomes static (Doesn't move, regardless of gravity or collisions). My understanding is that to make it static, I set the density to 0.…
Jesse Jashinsky
  • 10,313
  • 6
  • 38
  • 63
0
votes
1 answer

Box2D blocks wobbling/jittering/vibrating

I have a stack of blocks in my Box2D simulation (in Processing, using the Fisica wrapper for jbox2d), but they shake uncontrollable while they're moving. It's not that there unstable, it just looks really bad because they're shaking back and forth a…
mk12
  • 25,873
  • 32
  • 98
  • 137
0
votes
1 answer

JBox2D 2.1.2 Expection (new world creation)

I try to create an application for mobile phone LG GT-540 (Android 2.1). The application does not work if I initialize the new world ... world = new World(gravity, doSleep); Will be grateful for any ideas how to overcome this problem...
0
votes
0 answers

OutOfBounds Exception when creating a PolygonShape using jbox2d

I'm trying to create a body with a fixture in jbox2d TestBed, the fixture has 9 vertices. When I try to run the test I get the following error: Exception in thread "Testbed" java.lang.ArrayIndexOutOfBoundsException: 8 at…
MED_M
  • 101
  • 1
  • 2
0
votes
0 answers

JBox2d set body type dynamic sometimes failed

The effect to be achieved is to let the bodies drop down one by one. The previous code was to set all the bodies DYNAMIC when they were created, when the index increased the position.y increased, this made them ordered in a high column, some bodies…
jdleung
  • 1,088
  • 2
  • 10
  • 26
0
votes
2 answers

JBox2D collisions not bouncing

I have an Android application using JBox2D for physics simulation. The only dynamic object is a 0.07m radius circle, as well as several static circles and rectangles in a total game area of about 20m by 20m. I'm also using a few custom forces…
neuropie
  • 151
  • 1
  • 10
0
votes
1 answer

jbox2d on Android - circle not applied gravity and other staff

I am doing simple application that should put circle on Canvas when the user taps the screen and then put that circle in the PhysicalWorld I have defined. I draw the circle in "onDraw" method, but when it is created its position does not change…
Blunt
  • 3
  • 2
0
votes
0 answers

How to use jbox2d / Install in NetBeans?

I'm trying to figure out how to use "jbox2d" with NetBeans and I can't find any answers or tutorials. I need it for collision and movement. I tried importing it in many different ways, none of them have worked. I just didn't do it right, and I can't…