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
0
votes
1 answer

Box2D - body's position is incorrect

I have window 640x480. I use 4 static bodies as edge of window, so nothing can't move over the edge of window. This is one of the 4 bodies, 30 pixels represent one meter, all of the bodies are programmed with following method, but at right edge is…
kubaj
  • 63
  • 1
  • 7
0
votes
1 answer

Setting up Cocos2D and JBox2D in Eclipse

I'm trying to make an Android app using Cocos2D-android and JBox2D. I found several tutorials and downloaded sample code and it works well and I can build on it, however nowhere can I find clear instructions for how to actually set up my own new…
Amit Farkash
  • 329
  • 3
  • 16
0
votes
2 answers

Android OpenGL ES object feeze on sleep / screen lock

I have set up a project with OpenGL ES and successfully imported the jBox2D library. I have made a test project which includes two rect falling down. Works great! However, when the screen goes to sleep or I lock the screen, the falling objects stop…
stomseven
  • 157
  • 1
  • 2
  • 8
0
votes
1 answer

JBox2d TestbedMain.java "Selection does not contain a main type"

I have installed JBox2D through Maven on Eclipse Juno and in order to test the installation worked correctly, I am supposed to try running the TestbedMain.java but Eclipse keeps giving me the error "Selection does not contain a main type" and…
0
votes
1 answer

Work with images in Jbox2d (java)

I am trying to make the image move rather than a geometric shape in jbox2d. I dont see the image . BodyDef bodyDef =new BodyDef(); bodyDef.position.set(100,100); bodyDef.type=BodyType.DYNAMIC; …
Rohit Alekar
  • 89
  • 1
  • 3
  • 8
0
votes
1 answer

java.lang.IllegalArgumentException: already added: Lorg/jbox2d/callbacks/ContactFilter;

I have an android project and am trying to add JBox2D and added "jox2d-library-2.1.2.2.jar" as both a referenced library in Java Build Path|Libraries and via Android Dependencies and in both cases get the runtime error: UNEXPECTED TOP-LEVEL…
Graham Seed
  • 742
  • 3
  • 10
  • 24
0
votes
1 answer

playn skeletal build excudes jbox2d

Why does the default playn skeleton project not include jbox2d? And how do I include it in the maven build? I do understand how to include it into my IDE, but I would like the maven build to include this dependency fromt he git go
placeybordeaux
  • 2,138
  • 1
  • 20
  • 42
0
votes
3 answers

How would I use DebugDraw with pure JBox2D?

Okay, so this is my code (this is just a test of using DebugDraw): package test; import org.jbox2d.callbacks.*; import org.jbox2d.collision.shapes.*; import org.jbox2d.common.*; import org.jbox2d.dynamics.*; public class Main { private static…
roperson
  • 81
  • 1
  • 1
  • 4
0
votes
1 answer

Java Slick2D and Jbox2D

I have recently started to develop games in java using the Slick2D library and am really enjoying it. I have come to a problem where my game need physics and after browsing the web I have decided to use Jbox2D physics engine. Before installing…
Jake Runzer
  • 957
  • 3
  • 17
  • 35
0
votes
1 answer

How to use JBox2D debug-draw in Slick2D?

JBox2D, the Java port of the Box2D physics engine, features an extensible module for creating debug drawing of shapes. How can I use this with the Slick2D game library?
liamzebedee
  • 14,010
  • 21
  • 72
  • 118
0
votes
2 answers

How do I get a body to bounce around the screen when there is gravity (Box2D/AndEngine)?

I've done quite a bit of searching and have found multiple suggestions for anti-gravity objects, but nothing seems to work just right. I have a physics world created with Earth's gravity. The user taps the screen and creates sprites/dynamic bodies.…
rphello101
  • 1,671
  • 5
  • 31
  • 59
0
votes
1 answer

Do we have a RopeJoint in JBox2d?

Just a quick question, seems that RopeJoint is missing from jbox2d... is it really so or did they rename it to something? Distance joint works fine, but I want to it be flexible, like a rope, not a metal rod. :) DistanceJointDef jointDef = new…
Roger Travis
  • 8,402
  • 18
  • 67
  • 94
0
votes
1 answer

How to show JBox2D object in android activity?

I write a code for showing circle body by using jbox2D. But when is run this code i got blank screen. Now how to show this rigid body on screen. is i need to use any view for showing it on screen ?please help.. import…
krishna kant gupta
  • 121
  • 1
  • 1
  • 6
-1
votes
1 answer

Get sprite boundaries while sprite has an angle

So basically i have a sprite that I can move around with it being touched within its own boundaries. if(v3.x >= spear.b2body.getPosition().x - spear.getWidth()/2 && v3.x <= spear.b2body.getPosition().x + spear.getWidth()/2 && …
Marke
  • 189
  • 4
  • 13
-1
votes
1 answer

Adding a dynamic physic body to a drawn line

I'm developing a game with a similar mechanical to "Crayon Physics Deluxe" on libGDX (https://www.youtube.com/watch?v=avkacGQKWec). I'm stuck on the algorithm implementation of the drawn. The problem is that dynamics bodies doesn't work with…
dcjosej
  • 11
  • 4
1 2 3
12
13