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

learn more… | top users | synonyms

3
votes
0answers
84 views

How do I handle rope physics with fixed ends and a sliding weight?

I've been interested in rope physics recently—I've successfully implemented a simple Verlet rope with moveable ends. Now I am trying something a little different: I want to start by recreating the ...
1
vote
0answers
36 views

How to tell if a fixture is being squeezed by two other fixtures in Box2D?

Let's say I had a ground fixture, a player box, and a kinematic block moving up and down. If the player stands under the block, weird things happen. I want to simply play an event where the player ...
1
vote
0answers
50 views

Box2D random crash when adding joints

I'm currently working on a project which uses Box2D, when the player uses a certain key it should anchor to the ground. For that I use a weld joint, but when I add the joint the game will sometimes ...
1
vote
0answers
63 views

unity4.3 rigidbody2d unexpected force behaviour

So guys ive edited the question and here is what my problem is i have a player which has a rigidbody2d attached to it.my player is able to doublejump in the air nicely and stick to walls when ...
1
vote
0answers
266 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: ...
1
vote
0answers
53 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 ...
1
vote
0answers
63 views

Need to join 2 bodies via weld joint but not on center of mass

I have successfully join 2 bodies via weld joint , but my problem is I want to join corners of bodies not on centre of mass. Is there any way to achieve this? Above image consist 3 polygon body that ...
1
vote
0answers
149 views

Box2D Qt wrong collisions

I am working on a simple Box2D game (with Qt), but my objects don't collide correctly: As you can see on the picture, objects try to go through each other and slide over. My b2World: b2Vec2 ...
1
vote
0answers
226 views

Image Texture Tracing Algorithm - Cocos2D Box2D

Context: I am working on a 2D Destructible Terrain engine for Cocos2D with Box2D. All images, when a level loads, have their border's traced and cached for the purposes of forming Box2D b2EdgeShape ...
1
vote
0answers
204 views

beginContact triggered more than once on some objects

Short version: It looks like beginContact is detecting continuous collisions. I'd like to avoid that. Long version : I use Box2Dweb to write a 2D platformer. It's my first game using this lib, and, ...
1
vote
0answers
1k views

Why do restitution values less than one still cause infinite bouncing in Box2D?

I'm currently trying to implement basketball bouncing into my game using Box2d (jBox2d technically), but I'm a bit confused about restitution. While trying to create the ball in the testbed first, ...
1
vote
0answers
336 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 ...
1
vote
0answers
504 views

changing body type without change of center of mass

I have an box2d project with some bodies in it, which move around without any user interaction. But if the user selects one of the bodies, he should be able to move it around just like he wants to. ...
1
vote
0answers
821 views

How to properly add texture to multi-fixture/shape b2Body

Hello to everyone this is my first poste here I hope that will be not fail start. At start I must say I make part 1 in Ray's Tutorial "How To Make A Game Like Fruit Ninja With Box2D and Cocos2D". But ...
1
vote
0answers
249 views

Design pattern for procedural terrain assets

I'm developing a procedural terrain class at the moment and am stuck on the correct design pattern. The terrain is 2D and is constructed from a series of (x,y) points. I currently have a method that ...
0
votes
0answers
22 views

libGDX fixed object and camera do movement

I develop game to andorid and there is moving object with arrows - simple movement like in RPG games. I did: camera.position.x = PIXELS_PER_METER*man.body.getPosition().x; camera.position.y = ...
0
votes
0answers
15 views

Box2D - create object with different physic parts

I have object with physic: BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyDef.BodyType.DynamicBody; bodyDef.position.set(position); bodyDef.angle = angle; ...
0
votes
0answers
9 views

Destroying fixtures in Box2D/AndEngine

In my game I need to break of parts of a body when the body crashes into something too violently. Currently I do that by by getting all the normal impulses of the ContactImpulse and if the max value ...
0
votes
0answers
24 views

Intersection issue with box2d in iOS

I'm trying to use the code here http://www.iforce2d.net/b2dtut/raycasting So I can know whether a line cross a box2d object or not. It half works, in that when the line crosses the object it does ...
0
votes
0answers
82 views

How can I make a swinging rope?

Base question: How can I make a swinging rope in box2d? Context: The idea is to have a rope where the player can grab it, swing a little bit to get more "momentum" and reach the next platform. Like ...
0
votes
0answers
46 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 ...
0
votes
0answers
26 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 ...
0
votes
0answers
24 views

Speed seems random with constant impulse

I'm shooting an object from the top vertex of a triangle using Box2dWeb. The issue I'm having is that the projectile speed seems to be fairly random, even with applyimpulse set to a constant. The ...
0
votes
0answers
16 views

Box2D.js b2ChainShape

I'm using box2d.js (asm.js ported) and need to create a b2ChainShape. var bodyDef = new Box2D.b2BodyDef(); var fixDef = new Box2D.b2FixtureDef(); bodyDef.set_type(Box2D.b2_staticBody); var chain = ...
0
votes
0answers
66 views

Libgdx/Box2D PolygonShape has no position… well, what now?

As my prototype works perfectly fine I want to advance to more fun areas of the project and add a more complex player-character body. So for Box2D I figured I'd need multiple fixtures, like one for ...
0
votes
0answers
39 views

Drawing a object with Box2D and HTML5 canvas on current mouse position

I'm attempting to create a air hockey type game with HTML5 canvas and JavaScript, using Box2dWeb for the physics calculation. I need a way to draw the puck at the current mouse x and y position every ...
0
votes
0answers
31 views

[LibGdx]Moving a fixture on a body

I'm working with Box2D and I have a basic platform and a box bounces off of it. // Static Platform bdef.position.set(160 / PPM, 120 / PPM); bdef.type = BodyType.StaticBody; Body b = ...
0
votes
0answers
63 views

Box2D collision damage calculation from postSolve or not?

I'm using postSolve to get impulse then calculate damage base on that impulse. But there's some issue: Stability The damage isn't stable. When the same ball is hitting with same speed, the damage ...
0
votes
0answers
83 views

sprite reset method not working in update thread(andengine)

I have sprite array with length of 8 and I am trying to reset sprites position in scene's update thread but it doesn't work. However I tried to reset sprites in sprites modifier listner which works. I ...
0
votes
0answers
12 views

Complex Body with multiple BodyDefs

My complex body is made up of several parts some of which are static and some are dynamic and have specific positions relative to each other. Because the static/dynamic property and position goes in ...
0
votes
0answers
64 views

box2dlights conelight rotation is off

I'm using libgdx/box2dlights for my game~ I have a conelight set up as such: ConeLight cl = new ConeLight(rh, 32, new Color(0f, 0.0f, 0.0f, 1.0f), 3, 0, 0, 0, 1); where "rh" is a RayHandler set to ...
0
votes
0answers
56 views

Box2D and randomly generated tilemaps

I am making a 2D Terraria-style sidescrolling game. I want to use box2d for the physics. However, I am using tilemaps for the maps, and I do not know of a processor-efficient way to use Box2D bodies ...
0
votes
0answers
35 views

Box2d not showing consistent behaviour with sprites

Box2D newbb here. My question is in regards to this create js project:http://mboyeman.com/dashingdog/ (runs best in IE...:3) I wrote a function(assignBlockBodies) to give 2D Edges to sprites based on ...
0
votes
0answers
127 views

Shifting the camera and setting a new scene when using Box2D

My jsFiddle: // START -- MOVE CAMERA var p = new b2Vec2(); p = (ball.body.GetWorldCenter().x) * physics.scale; pos.push(p); var length = pos.length; var s = (pos[length - 1] - pos[length - 2]); //in ...
0
votes
0answers
44 views

2D Range Searching

I have a 2D jump'n'run browser game based on SVG, whereby the entire game-world is included in one huge svg (28px * 16000px, ~3.5MB). Unfortunately is rendering kind of too complex and the browsers ...
0
votes
0answers
50 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
0answers
40 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
9 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 ...
0
votes
0answers
39 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
0answers
95 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
119 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 ...
0
votes
0answers
133 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
0answers
400 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
51 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 ...
0
votes
0answers
105 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
40 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
0answers
46 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 ...
0
votes
0answers
39 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
0answers
564 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
0answers
246 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 ...