Box2D is an open-source rigid-body 2D physics simulation library for games, written in C++.

learn more… | top users | synonyms

0
votes
1answer
62 views

box2d ChainShape into curved line

i need to draw a curved line , i searched the internet and found nothing , maybe someone with knowlegde on the subject can help me with a link , i used chain shape and did this , and i don't know ...
2
votes
2answers
96 views

Box2D Issues determining the side of collision

I'm trying to determine which side of my object a collision is happening. In all of my searching, I have found 2 different proposed solutions, but each one has a major issue. I'm hoping that someone ...
0
votes
1answer
80 views

Client-server architecture with box2d

I am running a client-server architecture with an authoritative server running box2d and the client running box2d as well. If gravity is set to 0, is there any point to linear interpolation and ...
1
vote
3answers
70 views

How to handle transparent pixels in a spritesheet

I am trying to correctly handle transparent pixels. I have a spritesheet that gave me the following: The green body is the ground physics body and the gray body around the sprite is the sprite's ...
1
vote
1answer
31 views

Checking if Body is surrounded by other Bodies

I'm trying to make a game like Rampart as practice. I have gotten to the point where I want to check if the castle is surrounded by walls and decide whether to fill in the area and continue the game, ...
-1
votes
0answers
29 views

Body.getPosition returns NaN

I'm trying to create my own shooting Ai and for that I calculated at which angle the shooter needs to be depending on the distance from the target. The problem is that a whole lot of times I get this ...
0
votes
1answer
129 views

Move Box2D body towards mouse click

In a top down game using Box2D, I would like the player's Box2D body to rotate towards the mouse click, and then move to a point on mouse click (move, not teleport). I have worked out the rotation ...
0
votes
1answer
81 views

libgdx - Box2d debug draw not correct

I have a problem where the bodies in my debug draw does not draw correctly, take a look: As you can see, there is some space between the dynamic body and the ground. I have checked the contact ...
2
votes
1answer
142 views

LibGDX Box2D TileGame Efficiency

I am trying to implement Box2D into my top down tile game in LibGDX. Each world consists of a set of chunks, and each chunk is 16 tiles wide/long. The maximum/minimum chunks loaded at one time is 9 (a ...
3
votes
1answer
342 views

Change the shape of body dynamically

I have a problem where i have a ballon which i need to continuously inflate and defalte in update method, I have tried to used setScaleCenter but it is not giving desired result. Below is a code i am ...
0
votes
1answer
318 views

How to render a vertex buffer in DirectX11 C++ (specifically with box2d's b2Draw)

I have all the DirectX11 devices etc setup and working with DirectXTK's SpriteBatch and currently attempting to implement a b2Draw class to draw my box2d physics worlds. I have little idea on how to ...
1
vote
1answer
55 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) ...
0
votes
0answers
10 views

Box2d c++ can't see b2PolygonShape

i try to follow this tutorial and convert it to c++ http://www.emanueleferonato.com/2009/04/06/two-ways-to-make-box2d-cars/ the second part of the tutorial Now im facing very strange Behaviorno ...
2
votes
2answers
134 views

Box2D—how make character tilt

I have got a floating character, which should be a robot like thing, floating over the ground, whereby I am using the »hovercar« effect described here. Zhe Image below outlines the basic setup of the ...
1
vote
0answers
48 views

Calculate the rest length of a box2d distance joint

Given the length of a distance joint along with its frequency and the mass of the bodies involved, is it possible to determine the final rest length? I'm only interested in the vertical axis if that ...
1
vote
1answer
172 views

Changing Box2D Body from Kinematic to Dynamic after contact

What is the correct way to change a Kinematic body into a dynamic body? context - I have a dynamic body as a projectile which has to be fired at a kinematic body (it is kinematic because i am ...
1
vote
1answer
381 views

Wheel Joint Implementation in AndEngine

I am currently developing car game in AndEngine. In which I was using revolute joint for car wheel and chassis attachment. But my friend suggest me that use wheel joint for that purpose for better ...
2
votes
2answers
47 views

Pole vault with Box2D?

I would like to replicate the behavior of a flexible pole as used for pole vault. Can somebody give me some inspiration how to simulate that with Box2D? Would I cannot multiple objects with flexible ...
0
votes
1answer
102 views

Libgdx box2d crashing

im making a game in libgdx which i having a bunch of circle bodies floating around in space and when the player's body crashes into another body, that body deletes and creates two smaller bodies ...
0
votes
1answer
666 views

Communication between Box2D and libGDX Stage (Scene2D) running in separate threads

I'm making a physics based 2D game using libGDX and Box2D. I want to move the execution of the simulation out of render thread. I use immutable messages and the BlockingQueue to pass the information ...
0
votes
1answer
42 views

Why the triangulated body in box@d as a sensor is not treated as one but separate triangle bodies?

I am making simple game - kind of race game, where you see from the "sky" your sprites with circle Box2D bodies attached and they have to move along some path/track. My idea was to detect if they will ...
1
vote
0answers
41 views

Using Box2D in LibGDX, is there a reason a fixture set to be a sensor would only -sometimes- detect a collision?

I am working on a 2D game in LibGDX. Currently, I am testing interactions between a player's weapon and enemies - in particular, a sword and an enemy monster. The player has a hurtbox and the sword ...
1
vote
1answer
972 views

Drawing Shape in DebugView (Farseer)

As the title says, I need to draw a shape/polygon in Farseer using debugview. I have this piece of code which converts a Texture to polygon: //load texture that will represent the tray ...
1
vote
1answer
181 views

Lighting shadow casting sprites with box2Dlights

I currently have something like this using box2Dlights Ideally, I would like objects casting shadows to be lit, so the object is lit but there is still a shadow cast around it. Right now the object ...
0
votes
1answer
66 views

Set Position of multiple bodies

I have a character composed of five bodies which are tied together by a lot of joints. On of them is the overall chassis, to which all forces and impulses are applied to move the whole Character. All ...
1
vote
1answer
225 views

Dynamic Hills like Contre Jour in Cocos2d

I'm interested in maps/environments which are flexible and change at runtime, such as those in Contre Jour. I have looked for a long time to find out how to make this effect, but I couldn't find an ...
0
votes
0answers
25 views

Can't perform normal jump after applying revolute joint

I have encountered the following problem: I have two PolygonShapes which I had connected with a RevoluteJoint. The first body is called square the second is called weapon, before connecting the two ...
0
votes
1answer
61 views

My Raycast will not detect collisions in my Unity 2D project. What am I doing wrong?

I appreciate any help you can offer me. I created a script for a character controller that casts two rays below the player's gameobject. The rays extend infinitely and should collide with another ...
1
vote
0answers
58 views

LibGDX Box2D Lights - Illuminate background

I have a box2D world made of tiles. I use a custom DirectionalLight for light up the scene from above (It shines through transparent blocks [eg.: the water] more deeply). The problem is (as expected), ...
0
votes
1answer
35 views

Box2D: Making it Determinsitic?

From articles on the web, I found that floating point math generally has accuracy of at least 6 digits. With this in mind, is it possible to make Box2D which uses floats fully deterministic through ...
0
votes
0answers
32 views

Box2D replace Fixture not working as expected

I am using box2D to develop a simple game, and I am using the Physics body editor by Aurelien Ribon to load the fixtures into bodies. I have written the following method which should scale my ...
1
vote
1answer
83 views

Box2D setGravity() in Andengine?

Im currently using the Andengine GLES20 branch. I know that the new Box2D method setGravity() isn't implemented yet. Has anyone managed yet to get it to work with Andengine or to write a method ...
0
votes
0answers
30 views

Box2d :What is the best approach to build static Box2d smooth curve line [duplicate]

i want to know what is the best approach to simulate smooth curved line as static body it will be like path for car to drive . something like this : http://www.freeriderhd.com/ how does its box2d ...
2
votes
1answer
59 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 ...
0
votes
0answers
64 views

Preferred way to integrate box2d with SFML

I'm trying to integrate Box2D with sfml. My current solution is to have overloaded functions creating sfml shapes from box2d fixtureDef shapes. I store created sfml shapes under the name 'visual' in a ...
2
votes
1answer
86 views

Box2D Lights - Simulate water

I have a libGDX project, in which I have a Box2D world, which is currently filled with some boxes as a terrain. I also added a DirectionalLight to the scene for simulating the Sun. I almost have the ...
0
votes
1answer
41 views

Using Box2D for soccer physics

I've learned quite a bit of Box2D and I've succeeded basic stuff concluding ball physics. I want to implement 'opposing forces', as the character kicks the ball with a certain strength, with the leg ...
-1
votes
1answer
3k views

How change the size of sprite in cocos2d?

I want to change the scale of sprite like a paper in 'Paper Toss' game. 'Paper Toss' is the game is available on the App store. I want to make a sprite like a paper and change the scale of sprite ...
0
votes
1answer
225 views

Libgdx Box2D and Screen Viewport Scaling

I am currently having problems getting an easy to manage system of scaling my units for use with box2D. Normally I would create virtual units to go along with me viewport and camera but since I am ...
4
votes
4answers
3k views

Box 2d Level Editor for AndEngine [closed]

I am getting started with Box2d in AndEngine. I need to know if there is any level editor to be used with box2d and gives output capatable with AndEngine. Is there any tool which can help me building ...
0
votes
0answers
21 views

How will i know if the Body is facing a the target angle [duplicate]

I want to know if the body of the car is facing the line on the picture
1
vote
1answer
67 views

Dynamic body in Box2D with fixed position

I need to fix the dynamic body position so that it would not rotate and would not move even if there are other forces, collisions and so on. Let me first explain why I need this. I have a dynamic ...
1
vote
1answer
96 views

Implimenting BADLAND like Body Movement in Box2d

I am trying to make a body (character in my game) move and behave in the same way as the character in the BADLAND Game with regards to rotation. The character does not have fixed rotation and behaves ...
0
votes
1answer
29 views

How to trim a sprite?

I have a spritesheet: var spriteSheet = new createjs.SpriteSheet({ // ... frames: { width:520, height:600, regX: 260, regY:300 } // ... }); I am computing it's physics body as follows: ...
0
votes
1answer
55 views

Tiled PolygonObjects rendering wrong in libgdx

this is how I render the polygons in Tiled this is how they get rendered in libgdx. Notice the top part of the triangles is straight instead of being hollow. here is the code I use to convert the ...
1
vote
1answer
194 views

box2D and libgdx: Attach ParticleEffect to Body

Hello I am a newbie with libgdx, my question is: how could I add a Particleeffect to a Body that is moving? I searched about the matter and I didnt find anything related to it. I have the following ...
-1
votes
1answer
49 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 ...
0
votes
0answers
22 views

mouseWorld Coordinates Box2D

I have one simple question in Box2D: if you want to get the world coordinates of mouse, this is the function you gonna use in Java: void update(int x, int y) { if(mousejoint !=0) ...
2
votes
2answers
82 views

AndEngine rotate all connected bodies

I have created below hexagon structure in Andengine with box2D physics extension. I want to rotate whole structure with respect to center when other ball collides with the structure using physics. ...
0
votes
1answer
169 views

Explain the difference between extrapolation and interpolation

http://www.unagames.com/blog/daniele/2010/06/fixed-time-step-implementation-box2d here there are two algorithms of smoothing in case of fixed time step physics simulation. I don't understand the ...