Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

-1
votes
2answers
30 views

How to get color from texture at specific location in libgdx?

This is the screenshot of my game. This is a 2d platformer game where the player jumps to many differently colored tiles. On the left-hand top corner, there is a square tile which changes its color ...
0
votes
1answer
51 views

How can i collide two bodies without filtering(collision filtering)?

I have two bodies with fixtures. One is platform or ground and other is the player itself.I want to collide the player to the platform without bit filtering.How can i do that?I can see the rectangular ...
0
votes
1answer
24 views

Does destroying body also destroys the sprite?

Suppose a sprite is attached to a box2d body. And world.destroyBody(b); is getting called then the sprite also get destroyed or it stays there in memory. In my ...
1
vote
1answer
25 views

How to set a box2d body to follow a strict path

I'm making an infinite runner type game and I want one of my enemies (when it's created) to swoop down in a sort of U motion where it'll hit the player if they don't react quick enough once the enemy (...
0
votes
1answer
50 views

How to remove horizontal black bar at the bottom of the game screen in libgdx?

Here is the screenshot .Here is my Play constructor in Play class.
0
votes
1answer
43 views

Tuning physics for a “worms”-like game

I'm using LibGDX and Box2D for my physics but my characters bounce all over the place when moving and if there is a small slope in the terrain they launch off of it. I've tried tweaking settings but ...
0
votes
0answers
12 views

Box2d detect separated none blocking floor as blocking wall

I'm trying to make my character walk on walls, it all goes okay-ish currently until this situation. Here's an image to show you how the wall looks like https://www.dropbox.com/s/5oyn55qpzljlhnl/...
0
votes
2answers
36 views

What does linearDamping mean in Box2D?

If I set linearDamping on a body, it's velocity will be decreased slowly, until it stops. The documentation says, that the units are 1/time, which is unclear for me. If the velocity of a body is 10 m/...
3
votes
1answer
199 views

Is there a “Least Terrible Method” for sharing Entities over Network?

(Preface: Using C++, Box2D, and built UDP client and server classes that are reasonable efficient for a built-from-scratch game using client-server model.) This question is specifically in regards to ...
1
vote
1answer
66 views

Simulate wind affecting a boat using a 2D physics engine like Box2D or SpriteKit?

I'm looking for a way to simulate the forces created by wind and how it affects a boat. In a nutshell: if wind hits a boat (sailing yacht), the bow is aligning with the wind and if the wind is strong ...
0
votes
2answers
40 views

Why is the sprite so offset from the physics body?

I'm trying to make a sprite object that has physics, but once the game runs the physics body is drawn at an unknown offset from the sprite, which varies based on the size of the sprites texture. ...
0
votes
0answers
13 views

LibGdx TouchScreen Movement Logic with Box2D

I'm trying to implement some touch screen controllers to my game and i'm having a few issues :( i don't really understand what's the right way to do it, i can't figure out how to press simultaneously ...
0
votes
1answer
33 views

Box2D and OrthographicCamera working incorrectly

I'm trying to build a simple game where TileMapRenderer renders a labyrinth, a ball moves in it and camera follows it. I'm currently having the following bug: For some reason, the game renders the ...
1
vote
1answer
51 views

Box2d punch detection

So working on a 2d fighting game and wondering whats a good method for detecting punch collision. Ive got a few questions on how to implement the attack stuff. Im using box2d (and Libgdx) for the ...
0
votes
0answers
28 views

Box2D More Than 16 Categories

as I have got such a good answer on my other post I will ask this one too: Do you know a workaround or fix for the issue in the library box2d that you cannot add more than 16 categories? (I have read ...
2
votes
1answer
70 views

Drawing Explosions Respecting Walls

I am creating a tiled game (2D top down) and I created explosions working this way: The blue lines are walls, the white grid is accessable space. The red dot is the origin of the explosion with the ...
1
vote
1answer
63 views

Box2D simulation running slower on lower FPS(even when the desired FPS is lower than the actual)

I´m playing around and trying to make myself an easy platformer using the Box2D physics, before that I was not using it and was using my own physics implementation(just simple movements with timestep)....
0
votes
1answer
54 views

libgdx draw/animate curve (tentacle) according to Box2D spring wavering

The horizontally placed Box2D spring is made of distantJoint connected bars, and can bend up and down just like airplane wing does when you flight (bigger amplitude ...
1
vote
1answer
44 views

Why does my rendering not correspond with my Box2D world?

I've decided to try to use the Box2D physics engine in my game, and as I started I'm facing weird behaviour. I've followed a video tutorial where we setup the Box2D world with world gravity, and then ...
-3
votes
2answers
542 views

LIBGDX Let me know how to pause a game

I tried to make pause button. When users click Pause button on a screen, a window came out then, game is frozen until users press continue button in the window . my code is able to pop up window, ...
2
votes
2answers
72 views

let me know how to save an integer for game stage level?

I am trying to make a game which there are many stages. For example, If users are done stage 3 of the game, and then turn off the game, they can play the game at stage 3 anytimes. simply, I tried ...
0
votes
1answer
158 views

libGDX, box2d, Ashley ECS - Collision Detection using Box2d does not work when using components with Ashley ECS

I've just recently learned of Ashley ECS while searching up tutorials on the libGDX wiki and I've been replacing many aspects of my code with the Ashley ECS components which has made life a lot easier,...
0
votes
0answers
47 views

fixed moving distance of the object box2d (libgdx)

Another problem befell me during the development. May be i will be skilled enough to help other after finishing this project. But now i have questions myself. Most games are made so that the ...
1
vote
1answer
46 views

Frame independent box2d object movement

In my game I use box2d objects and, as I understand it, you can move them only in two ways, SetLinearVelocity, and ApplyImpulse. I need to move the object 32 pixels in 1 turn. So I make a constant ...
2
votes
0answers
142 views

How can I generate vertex data from an SVG?

I am trying out the Phaser game engine, and am interested in making a vector graphics game (simple black and white like Asteroids), but I want to use vector graphics instead of raster PNGs. I was ...
0
votes
1answer
154 views

Unable to get Box2dlights to cast shadows

I'm trying to use box2dlights to add lighting to my game and I have everything working except I am unable to have shadows cast with my box2d bodies. I also have collision working using category/...
1
vote
1answer
51 views

How to make body flying

I am trying to make a body flying is there any way to change gravity or hold the circle levitating? Here is the code i'm using: ...
1
vote
1answer
52 views

Translating ChainShape to world coordinates according to touch drag input

I'm trying to draw a ChainShape according to touch screen coordinates, however the coordinates are slightly off from my touch coordinates. I translate the chain drawn on the screen to world ...
1
vote
1answer
57 views

How to destroy multiple bodies

In my game(2D game) I have these fireball objects. When I launch a fireball I want to destroy the object (because I'm not going to use it anymore). I tried deleting the fireballs, but, from what I can ...
1
vote
1answer
66 views

crashing generating fire-balls(bullets) with Box2D

I got crash, making fire-balls as bullets. I guess I should not use "private Array fireballs" in player class. it seems like when I add one more fire as index of 1 into the list, the first index ...
0
votes
0answers
23 views

Display shapes of Box2D in CocosSharp for testing purposes

I'm using CocosSharp that uses Box2D to handle physics, separately. This means, in CocosSharp you draw your objects or set a sprite on a CCNode, while you use a ...
0
votes
0answers
98 views

Keeping Box2D body and Actor positions in sync using physics and Actions

I would like to make a simple entity class that extends Actor and has a Box2D body for physics. There are times when I would like the physics simulation to control the entity's movement and times when ...
2
votes
1answer
169 views

LibGDX player movment

I'm working on a project in LibGDX. It's a 2d platform game; you can say it's like Super Mario. So this is how I move my player to the right: ...
2
votes
0answers
150 views

How to render texture into box2d objects from Tile Map? Libgdx

I have a problem, when i try to render textures. I read positions of gameObjects, for example coin and create box2d objects circle shape. I have wrote game logic and began make a graphic. But for some ...
0
votes
0answers
39 views

Why a second manifold point in recognizing 2D collisions?

In 2D space, I can see how a box would fall over if pushed up only from one side but if one pushed from its exact center of mass it shouldn't rotate. So why then does the Box2D physics engine ever ...
4
votes
1answer
84 views

Object in Box2d doesn't sit perfectly on top of other object

I have a rectangle in my player class with the following properties ...
1
vote
1answer
93 views

Box2D - Constant Movement without ignoring Physics

I am developing a small game with LibGDX and Box2D. I want to move a body at a constant speed, lets say 2 m/s (meters per sec). The body should accelerate to that speed immediately when pressing the ...
0
votes
0answers
50 views

Fatal error… LIBGDX [duplicate]

I have an issue to launch fireball. when I launch fireball more than 10 swiftly, I got an error. especially, when my character becomes big which means to do redefine body.. I am still not sure why ...
0
votes
1answer
148 views

to remove body…in libgdx

I need to fix my destroyed fireball part. so, briefly, you can see there is condition, when fire ball takes 0.5 seconds, it will be destroyed, but the problem is that when I launch fireball more than ...
0
votes
1answer
153 views

error, how to remove BOX2D

I got an error, when I launch fireball too swiftly, I guess, my fireball does not really remove well. So that's why I got crush.. Can you guys check my update method, and please give me some idea? ...
0
votes
1answer
175 views

libGDX change map

I am struggling with changing map. Basically, when my character collides with the finish line, it should change to the next map. This is something like my simple code... Class A implements Screen ...
2
votes
1answer
43 views

Turn a spaceship at a max rate

Using the following to turn a spaceship in a C# FarseerPhysics simulation. var turnPower = _Inventory.EngineTurnPower * time; body.ApplyTorque(turnPower); If ...
0
votes
0answers
49 views

Phaser game crashes on focus loss

I keep getting this error after switching tabs Uncaught TypeError: Cannot read property 'GetType' of null at box2d.b2Fixture.GetType (box2d-plugin-full.min.js:9) at box2d....
0
votes
1answer
60 views

Box2d Javascript Disable Contact Between 2 Objects

I want two objects, when collided, to not effect each other in velocity or force. I have looked up guides and they say to change the PreSolve so that b2Contact.SetEnabled is false... which in code is ...
0
votes
0answers
59 views

Substepping concern for collision triggers

I've read "Fix your Timestep" article by Glenn Fiedler and convienced myself I should divide timing evenly on physics part. So I have did as follows: ...
4
votes
0answers
36 views

Physics - Determine how much thrust to apply at each thruster for linear/angular acceleration [duplicate]

I have a question somewhat similar to this one: 2D Spaceship Thruster Movement - Turning. I have a ship with thrusters placed randomly on it (not necessarily symmetrically), and I need to know which ...
0
votes
1answer
38 views

box2d prismatic joint friction

I know it is possible to add friction to rev joints by enabling motor and adding maxMotorTorque. I want the same for prism joint but only ...
3
votes
1answer
197 views

What is the proper way to convert meters to pixels when using Box2D?

I'm working on a platformer and I've chosen to use Box2D for physics but I'm having trouble converting meters to pixels. I have a static object and a dynamic object. The dynamic object falls onto the ...
0
votes
1answer
234 views

Should a bowling game use a 2d or a 3d physics engine? [closed]

I'm creating a bowling game in flash+as3. I'm new to physics engines, so, to start I've begun to learn Box2D since I've heard it's one of the most popular physics game engines. Currently, I'm not ...
2
votes
1answer
132 views

Box2d topdown racing game - killing “residual” forces

I'm making top-down race game in GM:S with Box2D, the car is controled in unusual way: player sets direction and engine's speed, and the car uses them: turns to the desired direction and reaches speed....