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

181 questions
18
votes
4 answers

Applying physics to Android View objects

I currently have an android application that utilises the native android views for the UI (e.g. imageviews/buttons etc) Although this app is not a game, nor requires any heavy graphics or OpenGL, I would like to incorporate a little physics-related…
Kurian Vithayathil
  • 717
  • 2
  • 6
  • 20
15
votes
1 answer

Slick2D and JBox2D. How to draw

Before asking this i did A LOT of searching on the net. I just can't do it. It's a little hard for me to understand. So how do i draw the images at the right screen positions coresponding to bodies in world position? Thanx. If anyone else finds…
Romeo
  • 376
  • 1
  • 3
  • 14
10
votes
1 answer

How can I prevent a ball from sticking to walls in Box2D?

I'm experimenting with box2d. I seem to have a problem people describe as sticky walls I have a ball and a paddle I'm using all the basic recommended scales I could find, 10m world, 1m ball The ball has the following properties: shape: circle (.5f…
Rob
  • 6,711
  • 4
  • 41
  • 71
9
votes
3 answers

Prevent body from rotating in Box2D

I am currently using Box2d, more precisely the Java port jBox2d. I have a circle that is colliding with other circles when falling (all those circles form a kind of a crank, see picture below). Naturely, the circle begins to rotate when falling.…
Undo
  • 1,025
  • 1
  • 10
  • 14
7
votes
3 answers

jbox2d tutorial

can you tell me: where can I find tutorials "programming games in jbox2d"?
Piotrek K
  • 105
  • 1
  • 1
  • 3
7
votes
1 answer

JBox2D - Find collision coordinates

I'm writing a program in Java using JBox2D. I need to find the exact point of collision between two textures, if and when they collide. I have the code to determine if a collision happens, and can obviously just call the collision object ID to…
bigcodeszzer
  • 854
  • 6
  • 20
7
votes
2 answers

How to find the contours of a frame from an Android camera and convert them to box2d bodies?

Using OpenFrameworks, OpenCV and Box2D I was able to achieve it with a good framerate. Using Android seems a much more complicated task (partly because I am a JAVA newbie). This is how I started: Use the "OpenCV Sample - image manipulations" and…
Joan Mira
  • 239
  • 1
  • 3
  • 9
6
votes
1 answer

Using Intellij + Maven to import libraries: Cannot resolve symbol

I have imported a library (JBox2D) using Maven in IntelliJ 13, for use in an android project. Maven didn't give me any error messages, so I assume the library was imported correctly. However, as soon as I try use a class from the library, I get…
abc32112
  • 2,357
  • 8
  • 34
  • 52
5
votes
2 answers

How would I detect the edges of an image (transparent background) in Java?

I have my image with a transparent background. I want to find the edges of the image and form a polygon from the outline. There are multiple methods/ways I could do this. I want to do it in Java (its for my game, which is using JBox2d Polygons for…
liamzebedee
  • 12,096
  • 19
  • 65
  • 114
5
votes
3 answers

How to check if a body has almost stopped moving in libgdx + box2d

So, I have a player body + fixture etc, it is essentially a ball that bounces around. I want to detect when it is 'pretty much' finished moving. At the moment I do this: public Boolean isStopped() { return body.getLinearVelocity().x <= 0.3f &&…
Tom Manterfield
  • 5,285
  • 4
  • 33
  • 49
4
votes
1 answer

Which direction is zero (0) in Box2D?

Which direction is considered 0 degrees in box2D? Is it north, south, east, west? And then do the angles increase clockwise, or counter-clockwise? I've read through the manual and it doesn't seem to mention this anywhere.
Jim
  • 631
  • 7
  • 26
4
votes
1 answer

What's the difference between JBox2D and libGDX Box2D

I have working on libGDX and use Box2D for simple 2D physic interactions inside my game. However, recently I have found the existence of a library called JBox2D. Is there any difference between this two libraries? What the advantages of one from…
Alex Sifuentes
  • 2,553
  • 2
  • 19
  • 33
4
votes
1 answer

How to make two bodies stick after a collision?

I am really stuck on this I can successfully detect a collision but I can't make the two bodies involved in the collision to stick. Here is my ContactListener world.setContactListener(listener); listener = new ContactListener() { …
user3197976
  • 101
  • 6
4
votes
1 answer

Box2D static body collision performance issue

I'm using JBox2d to perform collision detection in a game project I'm working on. I represent obstacles in the world with static bodies. Whenever a dynamic body (i.e. a game character) collides with one of these obstacles, there is a very noticeable…
Willow Boy
  • 41
  • 1
3
votes
1 answer

Where can I find fixture presets of different materials?

Where can I find fixture presets, that can be used in rigid body physics engines, like Box2D to simulate the behaviour of different materials? I'm looking for values of density, friction and restitution for common materials like: Smooth/rough…
Mariusz Jamro
  • 27,234
  • 22
  • 104
  • 144
1
2 3
12 13