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

learn more… | top users | synonyms

0
votes
0answers
12 views

setChaseEntity freezes or jitters the AnimatedSprite

I'm trying to implement setChaseEntity method in a physics based app. I wrote the below code which has an animated sprite ans as the player. The player is movable and it can jump. When i try to focus ...
0
votes
1answer
39 views

Player doesn't jumps in Box2D implementation [on hold]

Well, i'm trying to learn andEngine. I was able to successfully implement the move functionality for the player. Now, i'm trying to make the player jump using Box2D. I referred few online tutorials to ...
0
votes
1answer
49 views

Is there any reasons to make sprites and bodies line up?

So in LibGDX the Sprite objects position is where it's 0,0 mark is in the word. In Box2D a a bodies position is in it's center. So to line these up when you update the sprites position with the ...
0
votes
0answers
14 views

GWT problem with Box2D WheelJoint

I am using the below libgdx java code for a wheel joint and rear axle using Box2D. This works fine for android, Desktop, but when I attempt to run through GWT I get the following error. at ...
0
votes
0answers
5 views

box2dweb issue in DestroyJoint function

my jsfiddle : http://jsfiddle.net/H8e9m/9/ as you can see when the ball reach the pendulum end and collide with it by a revolute joint, the problem occurred when trying to make the ball release the ...
2
votes
1answer
25 views

How do I dynamically set a WheelJoint's anchor points?

I've created a car in RUBE and imported it into my game. The game has a tuning menu, allowing the ride height of the car to be adjusted with a slider. I can't work out how to change the position of ...
0
votes
0answers
25 views

Box2D—Dropshadow

I am about to create a Jump'n'run game using Box2D for the physics. I am asked to add a Dropshadow to the main Character, but as I noticed this could become quite complicated. Basically the Light ...
0
votes
1answer
31 views

SVG—Adding fire to the roket

as you might expect, I have got a game in development, including a main character—fortunately… This character is on the one hand represented by a bunch of Box2D bodies and on the other hand, ...
0
votes
0answers
17 views

Trying to make a mouseJoint with Box2D on Cocos2D-X

I'm trying to obtain this result: http://appcodingeasy.com/Gideros-Mobile/Dragging-Box2d-object-in-Gideros-Mobile (there's a video - YouTube). But I'm missing something, because if I follow the code ...
0
votes
0answers
40 views

How to find correct offset to adjust sprite to the position of box2D body after rotation

I am trying to implement phsyics with the as3 box2d port. I currently have a b2body for each of some certain sprites in my game and I am able to update the sprite's positions correctly from the ...
1
vote
0answers
35 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
votes
0answers
53 views

Body height width is different from sprite height width in box2d libgdx

I have a problem with box2d in libgdx. I was makin 5 kinematic moving platform on which a dynamic body player can jump. Height of plateform is varying from 20 to 110 pixel which I am passing to body ...
0
votes
0answers
24 views

Box2dLights rendering in bigger scale

So basically my box2dLights are rendering in wreid places. The circle in center is my player and as you can see lamp which should be aligned to player is in the right-top corner. my code: package ...
0
votes
1answer
50 views

How to get width and height from a body in box2d?

I am working on a game in Libgdx framework. I have to get width and height from a body in box2d. is their any way to get width an d height from a body in box2d??
0
votes
0answers
66 views

How can I load an SVG file and create a shape and collision data from it?

I'm looking to write a game in C++ with vector-styled graphics. For this, I will need to turn an SVG shape into a Box2D body and a polygon for rendering in SFML. I don't need the full capabilities of ...
0
votes
0answers
24 views

Apply impulse to ball to a fixed height Jbox2D android

I have to hit a ball to a fixed height repeatedly as shown in the following image. This game is similar to 1983 Hitit The difference is the hitting y axis will be variable. I wanted to hit the ...
1
vote
1answer
83 views

Movement and rotation of bodies in top down game

We are developing a 2D top down game with libgdx using the included box2d as physics engine. We don't want our bodies to accelerate but to instantly move with the wanted velocity. The bodies are ...
1
vote
0answers
69 views

Scrolling with SDL2 & Box2d - My Camera isn't keeping up with my player

I'm trying to get a game on the google play store before I'm 40 (long held dream to publish a game since the days of the speccy), I have just over a month to go so it's not looking good! Foolishly I ...
0
votes
1answer
34 views

Box2D: Adjusting character position for side-scrolling

In my side-scroller I would like to give the illusion of the character walking forward while his sprite is actually being held in place. If he walks near the edge of the screen, I would like to adjust ...
5
votes
2answers
198 views

How can I simulate a floating character in Box2D?

I am creating a jump'n'run game using the Box2D physics engine. The main character should be a robot like creature without legs, floating over the ground powered by a jet engine. The motion should ...
2
votes
1answer
32 views

Why can't I swap fixtures on collision in Box2D?

I'm trying to swap the fixtures associated with a body after colliding with a specific obstacle. I can listen to the collision event by extending b2ContactListener. I tested it with a trace and it's ...
-1
votes
0answers
31 views

Map in Scene2d/LigGdx

I'm a little lost for my game. For the moment I've a car, who work, but now I want to create a map (like hill Climb Racing for example, not necesserly randomly generated). I don't know how to do ...
0
votes
1answer
67 views

How do physics engines like Box2D detect and respond to collisions between arbitrary polygons?

I've always wondered how collision detection like this was achieved, and I've always wondered what the response would be. Do they perform line-line intersection tests for each line making up the two ...
2
votes
1answer
244 views

Maintaining velocity of free fall body using Box2D in libGDX

I want to maintain the speed of a free-falling Box2D body using LibGDX. I'd like the vertical velocity increase with the level. I've applied a linear impulse and velocity actually increases like this: ...
1
vote
2answers
35 views

(LibGDX) Changing Origin of Box2D World relative to TiledMap (or Vice Versa)

I'm playing around with Box2D and TiledMaps and I've come across this minor annoyance. As you can see, both Box2D and TiledMap render at the center of the screen. This forces me to compensate by ...
1
vote
0answers
62 views

LibGDX - Box2D: Realistic Light and Layers

I'm having some problems with my current game. Short description: It's a 2D game where you have to avoid the lights or you lose HP. My problem is the following one: Here is the rendering process: ...
0
votes
0answers
58 views

Simulating a single water droplet in Box2d

This is for a class project. The main character in the game is an oil droplet and we're trying to simulate it using Box2D. One of the levels in the game is where the oil droplet is in contact with ...
0
votes
0answers
14 views

Prismatic Joint causes a crash-Box2D(cocos2d)

tried to set up a prismatic joint, but I get this error upon run time: Assertion failed: (IsLocked() == false), function CreateBody, file ...
0
votes
1answer
65 views

Box2d stopping the movement of an object

I am in the process of making a game and I need an object to move only when the buttons are pressed. I have a method that begins the movement, and so far I am ending the movement of an object by ...
1
vote
3answers
69 views

Box2dWeb: setting velocity of bodies using events

I would like to move a kinematic box by pressing the down arrow. As is noted by the console logs, the keydown actually does change the box's velocity... but for reasons beyond my grasp it still ...
0
votes
0answers
23 views

Andengine Box2D Physics “disappearing”?

I have problems with my PhysicsWorld in Andengine GLES20. Sometimes when i first load my app and level there is no velocity added to my bodies. they also rotate slower as it seems. This also happens ...
8
votes
1answer
450 views

How do I make a curved surface out of rectangular blocks?

For a Peggle-like game, I want to make blocks that follow a curve, like this: The blocks would then disappear as the ball hits them. I managed to draw some horizontally, but I'm having trouble ...
4
votes
1answer
195 views

How do I simulate a trampoline?

I'm quite new to game development. I was pretty impressed with the elastic effect I saw in this flash game when the ball hits the trampolines and I'm wondering how to recreate it. I've done some ...
1
vote
0answers
27 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
21 views

Box2D Joints Disconnect

I'm trying to make a soft body physics system using rigid bodies in a circle. I'm having a problem where my joints only connect to one of the bodies, and seems to disconnect from the others. I think ...
0
votes
1answer
70 views

Trying to make sprite float up and down [closed]

Using LibGDX + Box2D and my understanding of the answer posted from this question: Here I apply the following impulse: // modify sprite's Box2d Body object int a = 8; // amplitude int f = 1; // ...
2
votes
2answers
136 views

How do I create a horizontally centered “gravity line”?

Here's my ideal scenario: A game object (in blue) can change its horizontal velocity, but it will be pulled back by gravity (dotted gray arrows) toward a central vertical line (in red). How can I ...
0
votes
1answer
89 views

How could I control an air hockey 's AI paddle?

I am making an air hockey game on Android with Box2D and libgdx. For the manual control, I just use the MouseJoint and it works perfectly. However, for the AI control, there is a problem: I've made a ...
0
votes
0answers
173 views

Box2D Soft Body Wheel in Unity3D

I was watching this video made with IForce2D, its about creating soft bodied wheels in box2D. http://www.youtube.com/watch?v=F-aDMZUVw0c I wanted help in being able to increase the Radius of the ...
0
votes
2answers
129 views

Box2D Libgdx removing bodies in case of simultaneous collisions

I am making a clone for the BreakOut game. I'm using Box2D and Libgdx for it. In the game, one scenario is that there could be 2-3 balls at one time. Now the problem occurs when 2 or more balls ...
0
votes
0answers
42 views

Box2d - Allow object to pass but still report collision [duplicate]

I am creating a laser which is a dynamic body with its own collision filtering. I want it to not collide, as it does not currently but I want it to still report the collision or when the two overlap. ...
1
vote
2answers
81 views

How can I find all connected objects of the same type recursively?

In my game, when a user selects an object of some type, I'd like to search for all other objects of the same type that are connected to that first one. For example, if the user selects a object of ...
0
votes
1answer
76 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
75 views

box2d's ApplyForce works wrong after cocos2d-x's replaceScene

i'm practicing making a breakout game, using cocos2d-x 3.x and box2d, referencing here. i create a ball in the scene's init function and apply force. when ball hits bottom wall, if i touch screen ...
0
votes
1answer
382 views

How to set a body to a specific position using Andengine

I'm developing a game with a single player and multiplayer mode. Lets say I have walls (static bodies), vehicles (dynamic bodies) and bullets (dynamic bodies). It works fine to control my own vehicle ...
0
votes
2answers
79 views

Floating point precision issue with Box2D

I'm using Box2D and I am putting edge tiles as b2Bodies so that the tile world can have physics: The problem is that there are 3 b2_kinematic bodies under the player right beside each other. Every ...
0
votes
1answer
63 views

Box2D + Citrus Engine - Proper Pong Paddles

I am creating a pong clone for my first Citrus Engine project using Box2D. I've tried two types of paddles, both do not fully work. 1) Paddle is a dynamic body with a restitution of 1.0 and friction ...
0
votes
1answer
117 views

How do I prevent other dynamic bodies from affecting the player's velocity with Box2D?

I'm working on my player object for my game. PhysicsBodyDef def; def.fixedRotation = true; def.density = 1.0f; def.position = Vec2(200.0f, 200.0f); def.isDynamic = true; def.size = ...
2
votes
1answer
120 views

Using Box2D / Physics with Tiles?

Here is my issue. I currently have Box2D setup and working. But, it works with my Entity system. So I can create static objects and dynamic moving ones, and they simulate fine. However, my world is ...
0
votes
2answers
69 views

How can I get the force of a collision in Love2D?

Is it possible to get the force of a collision between two objects in Love2D/Box2D? If so, how?