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

How do I set a RevoluteJoint angle and velocity exactly?

I've built a simple simulator using JBox2D, which involves a character built from a collection of bodies and four Revolute Joints. I've run into a problem: I need to restore the 'pose' of this character exactly, given a list of joint angles, joint…
amm
  • 343
  • 3
  • 11
2
votes
0 answers

how to set image background to jbox2d polygons

I am trying to develop a game in android follwing the jbox2d example called "Jbox2DTestbed" upon the BodyDef I want to set a image bitmap from my resource but my code is not working. the original look of varyingfriction example is as it is: …
NavinRaj Pandey
  • 1,674
  • 2
  • 26
  • 40
2
votes
1 answer

Box2d collisions assert error

I'm using AndEngine anchor-center branch so I can't use PhysicsEditor to create bodies/fixtures since the only parser PhysicsEditor-AndEngine it's a bit out of date and doesn't support anchor-center, so I thought I could use R.U.B.E instead and it's…
GuilhE
  • 11,591
  • 16
  • 75
  • 116
2
votes
1 answer

I have a boundary that splits my world into two, I want to allows certain boxes to pass through it and the rest to collide

That's what my world looks like. there are two classes : box and boundary. I want some of the box objects to pass through the green boundary, remaining to bounce off. You can think of the green boundary as a filter of some sort. class Boundary { …
Rakesh Adhikesavan
  • 11,966
  • 18
  • 51
  • 76
2
votes
1 answer

Loading R.U.B.E JSON file into Box2D

I am really interested in using the R.U.B.E editor to create my own players and what not. I am getting accustomed to Box2D through the use of LibGDX. But i can not find any resources (tutorials or examples) on how to load the JSON file into the…
Danny Watts
  • 579
  • 1
  • 6
  • 18
2
votes
1 answer

Destroy body on collision JBox2D android

I need to destroy one of the body's after collision in JBox2D android game. I found that JBox2D world become locked when body's become in contact. I wanted to destroy one of the body after collision. Can i get any call back after world released lock…
Sujith
  • 7,543
  • 1
  • 28
  • 38
2
votes
1 answer

Draw and moving shape issues

I got an issues concerning the vertices of my shape. The origin is at the top left corner (0,0) when I set the position of the bodyDef at 1, 1 bodyDef.position.set(position.x, position.y) the body do a translation diagonally by applying a vector…
Fr0z3n7
  • 2,548
  • 2
  • 14
  • 15
2
votes
1 answer

Why body is not falling under gravity?

I am new to box2d and libgdx game development framework. I have created a world and a circle shape. I am in Trouble with Gravity. The Circle I created in libgdx box2d is not falling under gravity. plz help me i stuck at this problem . public void…
Ravi Kumar Mistry
  • 1,063
  • 1
  • 13
  • 24
2
votes
2 answers

libgdx/jBox2d adding phantom bodies upon collision?

I'm using libgdx and jBox2D for the first time (though I've used Box2D in other environments before). I created a large dynamic body, and two smaller static bodies for it to land on. My bodies never seem to touch. Instead, it seems like the system…
Percipient24
  • 183
  • 2
  • 8
2
votes
1 answer

Box2d: set mass on a figure

Currently, mass on a figure is set using the area of the shape and its density. How can i set the mass if I already know it? I have tried creating a fixture with a box shape with a certain mass using public FixtureDef createfixture() { …
2
votes
1 answer

PlayN JBox2D Y velocity increases but collision happens

So i'm seeing a really strange problem. using the PlayN peas demo from the showcase i put together a simple app - i have a dynamic entity dropping onto a static entity and i cannot figure out why it isn't bouncing. After doing some printouts i find…
sean christe
  • 879
  • 2
  • 7
  • 24
2
votes
2 answers

How to detect if a particular body is touched in jBox2D

I am developing a game using jbox2d in conjunction with jBox2d for android. I would like to detect if user touches a particular dynamic body among various bodies in my world. I have tried iterating over all the bodies and find one of my interest but…
rahil008
  • 173
  • 1
  • 7
2
votes
1 answer

How do I detect that all bodies in the world have reached zero velocity?

I am using the java port of box2d. I was wondering, is there a way to detect when all the objects in the box2d world have reached 0 velocity? like a callback or something? thanks!
dewijones92
  • 1,319
  • 2
  • 24
  • 45
2
votes
1 answer

Can someone give me an example of how a mousejoint works in libgdx?

I have been banging my head against a brick wall for the past few hours. I can't for the life of me get a mousejoint to work in the libgdx framework or java. Could someone provide me with a quick example with sourcecode on how to use a mousejoint…
dewijones92
  • 1,319
  • 2
  • 24
  • 45
2
votes
1 answer

How to get half width and half height from a body in jbox2d

So I have Body body that is a rectangle. How do I get its half width and half height?(I could not find an answer anywhere else)
me me
  • 778
  • 2
  • 7
  • 18
1 2
3
12 13