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

learn more… | top users | synonyms

0
votes
0answers
34 views

2D collision beetween a sprite and an array of sprites [duplicate]

I am creating a simple Android jumper (think Doodle Jump or Abduction) using libGDX so I can get started in game programming. My problem is that I need to figure out a way to check for collision ...
1
vote
1answer
191 views

Syncing world in a multiplayer

I have been working on a client-server architecture for my multiplayer game. The server is used for communication between Clients. There is no cheat control because I trusting all clients :) I don't ...
0
votes
1answer
33 views

Using texture() in combination with JBox2D

I'm getting some trouble using the texture() method inside beginShape()/endShape() clause. In the display()-method of my class TowerElement (a bar which is DYNAMIC), I draw the object like ...
1
vote
1answer
92 views

Box2D relations

As far as I know, the unit in Box2D is meters. When I use Box2D in Processing with JBox2D, I set the "world size" as the window size specified in the setup(). Now I'm wondering if there is any ...
0
votes
0answers
80 views

Physics don't apply on a unique body AndEngine

I am developing a game in AndEngine so far I managed to create everything I wanted for my sprite that was connected to a BoxBody. I was rotating it moving it everything was great. I wanted my ...
5
votes
1answer
265 views

Running multiple box2D world objects on a server

I'm creating a multiplayer game using LibGdx (with Box2d) and Kryonet. Since this is the first time I work on multiplayer games, I read a bit about server - client implementations, and it turns out ...
1
vote
0answers
62 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 ...
2
votes
1answer
147 views

JBox2D Polygon Collisions Acting Strange

I have been playing around with JBox2D and Slick2D and made a little demo with a ground object, a box object, and two different polygons. The problem I am facing is that the collision-detection for ...
1
vote
1answer
335 views

Movement of body after applying weld joint

I have two rectangular bodies. I've applied Weldjoint successfully on these bodies. I want to move that joined body by applying linear impulse. After weld joint, these two bodies becomes single body ...
0
votes
1answer
714 views

coloring box2d body in LibGDX

I want to color polygon of box2d in LibGDX. Found below useful class for that. http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html But, it is not ...
0
votes
1answer
384 views

Box2d making a body follow the mouse accurately

I am trying to make a box2d b2Body follow my mouse position. This is the code I am using at the moment but it is not performing very well: deltaPos = mousePos - body->GetPosition(); deltaPos *= k; ...
0
votes
1answer
104 views

Move background with the player location

I want to move background with player location in ios . I have implemented the infinite parallax background by using the CCParallax class but i don't need it. I want to do something similar to this ...
3
votes
1answer
539 views

box2d raycast filter category

I am trying to filter a category in my ray casting (jBox2D within libGDX), which should return the closest object that does not belong to the category LEVEL0. I've tried a plethora of approaches, but ...
0
votes
1answer
79 views

Getting a sprite from multiple sprites for right material pattern

Not sure how accurate the question was but I'll put it this way. I'm developing a game where player will construct his/her own stuff, like bridge, building etc. using cocos2d-iphone and Box2D. First ...
3
votes
3answers
773 views

How to make Box2D bodies automatically return to a initial rotation

I have two long Box2D bodies, that can collide while moving one of them around with MouseJoint. I want them to try to hold their position and rotation. Blue body is moved using MouseJoint (yellow) ...
0
votes
1answer
325 views

Box2D Static-Dynamic body joint eliminates collisions

I have a static body A, and a dynamic body B, and a dynamic body C. A is filtered to not collide with anything, B and C collide with each other. I wish to create a joint between B and A. When I ...
0
votes
1answer
230 views

Remove a body when touched in LibGDX(Box2D)

I am using LibGDX to create a new project. What i am trying to do is, i load bodies from a tmx file into levels which works fine. The bodies also has a sprite with them. The problem is, is i would ...
1
vote
2answers
349 views

How do I make a Box2D object that makes objects passing through it slower?

I wish to have a sort of "slow motion" or "slow down" effect on a players character when they walk in a mud area, usually the character velocity is 3f constant in any one direction. The problem is I ...
1
vote
1answer
284 views

Making a 2D TMX tile map

Should there be a specific link between the characters height as well as the tile size for the tile maps? That is if a tile is 32x32 does that mean that a character sprite has to be the same size? ...
1
vote
1answer
100 views

How to reduce the time it takes to speed up an object?

I have a body that I am applying a force to every step. However, I it takes a significant amount of time for it to speed up, which I do not want. Is there some value I can adjust to help with this?
0
votes
1answer
188 views

Getting body position

I am using BodyA.getPosition().x and BodyA.getPosition().y to get the x and y vector of a body location so i may attach some text above its head, but the log of that position prints out something like ...
0
votes
1answer
96 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
241 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
290 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
62 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 ...
0
votes
0answers
124 views

Impact js Multibody entities with animations

I have a simple impactjs project working with box2d. just a "car" that can run over some rough terrain. I would like to have the wheels spin though. I know I could accomplish this with a sprite sheet ...
6
votes
0answers
270 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
213 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
138 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 ...
0
votes
1answer
2k 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
475 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
196 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
445 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
166 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
310 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 ...
0
votes
0answers
376 views

Libgdx - Box2D: Attach Physics Body Editor Loader mask to dynamic texture

I have a texture of a circle, which gets drawn to a new position when a touch drag occurs. It isn’t set up as a body. I have made a physics map using Aurelien Ribon's Physics Body Editor Loader GUI ...
1
vote
1answer
271 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
0answers
144 views

Chain Shape Collision

I am facing a new problem by using chain shape. The collision between two chain shape bodies doesn't happen as the collision between normal bodies. So is this normal behaviour or am i doing anything ...
0
votes
3answers
353 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
654 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
289 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
259 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
201 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
106 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
267 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
120 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
442 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
718 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
174 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
117 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 ...