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

learn more… | top users | synonyms

0
votes
1answer
99 views

Encapsulating Box2D C++ two virtually the same functions

I have two functions that are virtually the same with a few small differences in code, one to create a static body and one to create a dynamic body, however if I call both of them it results in a ...
6
votes
1answer
272 views

How do I duplicate a Box2d simulation, mid-simulation?

I want to serialize the state mid-game, send it over the network to an identical computer (same CPU, same OS, same binary), load it there, and have the two games run in tandem doing the exact same ...
0
votes
1answer
331 views

Showing trajectory indicator

From the image you can see that the ball fired on the left that fire behind it, does not match the calculated trajectory. Im drawing the ball trajectory using an equation from a SO question, this is ...
0
votes
1answer
70 views

libgdx fixture is giving unresponsive error

need some support. I am novice in libgdx game engine. Below is my code package com.game.box2d.fruitcart; import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import ...
6
votes
0answers
300 views

Box2D strange collisions (jitter) on sharp edges [closed]

I'm currently developing 2D side scroll game with Libgdx + Box2D. And I'm facing some problems with ChainShape (the ground) and PolygonShape (the cart body) collisions. Please look at this video: ...
0
votes
0answers
247 views

Box2D revoluteJoint Motor speed,Max torque scaling for diff Devices

Hi i am using Box2d Revolute Joint as a joint for wheel it's connect to Wheel and Body of my Car i am using RUBE for creating the Box2D world Prob. i am using a scaling floating point number to scale ...
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 ...
2
votes
1answer
3k views

Libgdx explain steps for beginner to create and use image as a box2d body [closed]

I am basically from corona background and new to LibGdx , familiar with stage and actor from scene2D. Now wants to use physics body from box2d in the game besides using actor from scene2D. But I ...
0
votes
1answer
669 views

Movement with box2d using libgdx

I am pretty new to using physics engine and would like to know what is best practice for movement of playercharacters. Currently I have a class called Hero that has a CircleShape and when the user ...
3
votes
2answers
228 views

Box2d : How to apply a force to keep swinging from left to right?

i'm losing myself in this... Situation: Working on a game in cocos2d with box2d and I have a ropejoint between one fixed body and one dynamic body. When I drop the dynamic body is swings from left ...
1
vote
1answer
488 views

Box2D: Efficient method to create b2Chainshapes for a tile-based map?

I'm working on a platforming game with tile based levels. I store the collision model for my tileset in an array. This is how the collision model for a 4x4 tilesheet would look like (I can't post ...
0
votes
1answer
202 views

Rotating an object about a point (2D) using box2d

i just started developing using box2d on flixel and i realise the pivot point of the rotation of an object in box2d is set to the center of an object. i had read on forums and i found out that ...
2
votes
0answers
356 views

Choosing a level editor of a 2d platformer [closed]

I'm working with a small team on a 2D platformer game in Java (LibGDX) that uses Box2D for physics. Our team is looking for a tool to make the levels (that we will be able to integrate with the Box2D ...
1
vote
1answer
278 views

Correct way to update my physics frame rate

I've searched around here and Google and at last I looked at Fix your Timestep! article on the web which most of the people suggest. In according to that article I came up with an update method like ...
0
votes
3answers
453 views

Box2D body jitters when colliding with static body

I am developing a game where a body is moved within the scene using touch. The scene has a boundary wall made up of static rectangular bodies. When I move the object along the boundaries, on ...
0
votes
1answer
766 views

Error using Physics Body Editor for LibGDX

In my game, I've been trying to use the physics body editor for libgdx, but I kept on getting an error. So I thought there was probably something wrong with my code so I took the example off of the ...
2
votes
1answer
326 views

Camera scrolling and game boundaries

I am making a platformer game in JBox2D and LWJGL that has a scrolling camera, but I have hit a wall with the boundaries of the camera. Essentially what I have right now is a Box2D world that is ...
2
votes
1answer
282 views

How do I make my camera follow a Box2D object?

I'm implementing a camera in my game. It worked for regular objects, but I began using Box2D and obviously things changed a bit. I have a Body object that I want to draw at the center of the screen. ...
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
1answer
126 views

Starter love2d physics program not working

I am starting out with my first love2d (using LöVE 0.8) physics program. I am just creating some ground/floor, a car body and attaching two wheels with revolute joints and setting the motors a-go. ...
1
vote
1answer
319 views

Is it a good idea to use box2d to control sprite movement in a 2D game?

I'm trying to use Box2D to control sprite movement.Some burning issues are these: 1.When I trying to move the sprite on a slope or a lean barrier. The sprite will move off the slope which is not what ...
4
votes
1answer
134 views

Is it possible to apply a texture inside a GL_LINE_LOOP?

I am creating a game using Box2D and OpenGL ES 1.1. I am taking the b2PolygonShape vertices and converting them into an OpenGL ES 1.1 GL_LINE_LOOP. The debugging view looks great, but now I want to ...
4
votes
1answer
483 views

C++ SFML Box2D - Somewhat confused when it comes to syncing phyisical body with a render body

While testing Box2D with SFML I encountered something which confuses me: The relation between physical body centroids and SFML's sprite origin. As an example I have a test class GameObject which is ...
1
vote
1answer
801 views

2D Destructible Terrain with Box2D / Cocos2D -> Image Tracing

Bear with me as this will be a rather lengthy post. For the last month I have been working on an open source Cocos2D, Box2D Destructible Terrain Engine. I have some questions regarding its ...
1
vote
0answers
202 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
1answer
132 views

Cocos2D: Box2D body that is movable by one type of object but not another

I'm in the process of creating a simple platform game using Cocos2D 2.0 and Box2D. I'm trying to create a kind of crate object that cannot be moved by the player, but that can be moved by an elephant ...
2
votes
1answer
369 views

Box2D: Asteroids-Like Spaceship Physics

I'm new to Box2D (JavaScript) (and the world of physics/mathematics) so I'm having a hard time working out the methods I need to use to make a spaceship act like it does in the classic arcade game ...
1
vote
1answer
604 views

Box2d contant speed before and after collision

I want to make my body fly at constant speed, how to make it fly at constant speed before and after collision? I set restitution of my body to 1.0 but after some direct and powerful collisions my ...
4
votes
1answer
392 views

Box2D Joints in entity components system

I search a way to have Box2D joints in an entity component system, here is what i found : 1) Having the joints in Box2D/Body component as parameters, we have a joint array with an ID by joint and ...
3
votes
0answers
133 views

How to make the Angry Birds “shot arch” dotted line? [duplicate]

I am making a game that includes 2D projectile flight paths like that of Angry Birds. Angry Birds employs the notion that a previous shot is shown with a dotted line "arch" showing the player where ...
3
votes
1answer
423 views

How to implement server side physics?

I am working on 2-player 2d sidescroller. How should I implement the physics on the server? Use one world for every game or use a big world in which I add every 2 player that start a game? I have ...
2
votes
1answer
199 views

Using Box2D for range detection?

I have two entities. One has a sword, one has a bow and arrow. When the bow entity is 100 units away, he needs to begin attacking. Likewise, when the sword entity is 10 units away, he needs to begin ...
-2
votes
1answer
105 views

Language & framework for fast prototyping Box2d problems [closed]

I am often in need of a fast prototype box2d scene where I can play with parameters. I work with AndEngine on Android which doesn't suit me for prototyping. It's good for the final game, but ...
-3
votes
1answer
406 views

How do I change gravity of box2d world after world is created?

I want to modify the world of box2d after creating it, namely to change the gravity vector. Is there a way to do this?
2
votes
2answers
123 views

AndEngine: edit elasticity on action

I'm making a game for Android with AndEngine. It's going quite well, but now I'm stuck on something. My main character has a elasticity set in its fixturedef so it bounces around throughout the ...
4
votes
1answer
976 views

Problem Implementing Texture on Libgdx Mesh of Randomized Terrain

I'm having problems understanding how to apply a texture to a non-rectangular object. The following code creates textures such as this: from the debug renderer I think I've got the physical shape ...
6
votes
1answer
1k views

Generating a physics body for 2D Worms-like Terrain

I wrote a processing sketch that generates hills for a scorched earth clone, like this: I'm trying to figure out how to make this a physics object in libgdx, but I'm having problems figuring out ...
0
votes
1answer
352 views

Moving a Box2D object in the direction it is facing using applyForce [duplicate]

I'm trying to apply force to a polygon physics object to move it. Whilst I can get it to move upwards easily enough, I'm trying to get it to move in the direction in which it is pointing. Here's my ...
1
vote
1answer
97 views

Ring and Pole - Box2d

How I can make a b2Body in box2d so that it could form a ring which does not collide from the center just like a ring. like when we flick the object and there's another body (like pole), the pole can ...
7
votes
1answer
821 views

How to simulate feather fall in box2d?

I am working with AndEngine with Box2d extension, but general answer or a concept idea will be appreciated too. I have feather-like objects in a 2D side view world that I want to be part of the ...
4
votes
2answers
400 views

2.5d with box2d - approaches from the top and bottom

So, I'm using box2d for my 2.5d game (think double dragon, tmnt arcade, castle crashers) where you can move around on the z-axis (faked as y-axis movement). Basically, I have box2d only doing ...
1
vote
1answer
410 views

Hill-jumping game mechanic like Tiny Wings

I'm a huge Tiny Wings fan and I'd like to understand the game mechanic at a deeper level. What are some good resources for the basic Box2d (or similar) physics behind the hill-jumping game mechanic? ...
2
votes
2answers
215 views

Client-side physics simulation

I am trying to create a very simple client-server based physics game, using box2d library. A simple football game. Obviously, the server runs only the box2d world. My question is: is it correct to ...
3
votes
1answer
396 views

Separation algorithm in flock simulation?

I'm using box2d (the c++ one). I found a method for an arriving behavior (on http://www.red3d.com/cwr/steer/gdc99/ ), which works well, problem is, the bodies are bumping into each other and it ...
0
votes
1answer
401 views

Is there a “box2d without physics” lib (only for collision detection)?

Box2d Collision detection algorithms are probably the best ones out there. Unfortunately, they are bundled together with a realistic physics engine that I don't need. Is there an open source project ...
1
vote
1answer
156 views

Bodies do not stay sticked together by joint in retina display

I'm rehearsing on Box2D revolute joints. Everything's going pretty well except for one thing. For some reason bodies joined together with revolute joints do not stay sticked, they start getting apart ...
3
votes
1answer
365 views

How do I copy box2d data from one body to another?

I want to copy all Box2D-related data (position, velocity, rotation, impulse, ...) from one body to another. This is what I've got working (with box2djsweb): var t = body.GetTransform(); ...
0
votes
1answer
587 views

Why might a body suddenly stop while moving on continue platform?

I have a 32x32 sprite and I make some to be platform like this for (int i = 0; i < 15; i++) { attachChild(new Ground(32 * i, 200, regPlatform, vertexBufferObjectManager, physicsWorld)); } ...
1
vote
1answer
769 views

Is using Box2D for simulating gravity “in space” a good idea? [duplicate]

I'm attempting to write a simulation of a solar system of planets in 2D space that are attracted to each other through Newton's law of universal gravitation. I know that it is possible to simulate ...
0
votes
0answers
291 views

Slow Rope Joint Simulation

I am right now developing game similar to Cut The Rope. But I have some problem in developing this game. I have successfully created rope and attached multiple rope with candy. Below I represent ...