Skip to main content

Questions tagged [box2d]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
111 views

I was making a 2d top-down game, but when I tested it on two devices (Samsung M31 and Samsung S25) there was a problem with player speed - it was faster on S25 and slower on M31. I tried using some ...
andrew's user avatar
  • 31
0 votes
1 answer
142 views

I'm completely new to Box2D. I'm implementing some tests with Raylib. I managed to implement the collision between static and dynamic rectangles and now I want to insert circles into the simulation, ...
davidbuzatto's user avatar
0 votes
1 answer
113 views

I have a game object with a Kinematic body and a sprite. The object's "draw" method will always position the sprite to match a position of actual body, so the sprite is completely passive. ...
guest86's user avatar
  • 113
0 votes
0 answers
39 views

I have about 100 circle colliders set to dynamic/continuous. They're all being dropped into a "hopper" at the start of the level. I've noticed that this is: A) Tremendously expensive (as I ...
Programmer9000's user avatar
0 votes
0 answers
74 views

There is a thin, long rectangle placed slightly below a circle, and I let them fall simultaneously. When they hit the ground, they land perfectly aligned, one on top of the other. In the real world, ...
shingo.nakanishi's user avatar
0 votes
1 answer
236 views

What does the phrase "Kinematic bodies do not react to forces and only collide with dynamic bodies" mean? Related: I'm always confused by game engine physics explanations I found this ...
shingo.nakanishi's user avatar
0 votes
1 answer
88 views

I'm coding a simple Arkanoid/Breakout game and have problems with removing the bricks. I'm able to destroy the body but the texture is still there. I'm a beginner so is there a simple way to remove it ...
K.U's user avatar
  • 1
0 votes
0 answers
129 views

I recently learned a little bit of OpenGL through learnopengl.com. I've got through the window, gone through the triangle, then shaders along with interpolation, textures, and now transform. When I ...
Bobby Neal's user avatar
0 votes
1 answer
90 views

Im trying to connect bodies together to make some sort of a "building" system or more specifically im trying to make multiple "blocks" connect to eachother but Struggling to figure ...
Ziv the fire's user avatar
1 vote
0 answers
71 views

I'm developing a pool game using SFML and Box2D, and I'm currently facing an issue with creating the cue ball outline when the player aims. I have three rays that are cast: two black ones and one ...
Yosef Sirak's user avatar
0 votes
1 answer
113 views

I'm coding a game with Flutter and the flame_forge2d package (which uses Box2D internally). I want to make a game whose principle is similar to that of the game One More Bounce (a game where you have ...
Alex Irié's user avatar
0 votes
1 answer
99 views

I'm currently working on a LibGDX Java Game Project inspired by the Space Invaders game where I have created 2 Scene Classes: LevelScene and ...
TechGeek49's user avatar
3 votes
1 answer
182 views

I am creating a simple OpenGL C++ game. I have a main character (green box) and some static objects (red boxes) positioned as stairs. The problem is as green box is descending down the stairs, it ...
Axel's user avatar
  • 33
0 votes
0 answers
124 views

What I want I want a physics engine that can support a few dozen balls and polygon objects interacting with each other in a closed environment. It needs to support objects rotating after collision. It ...
redmoncoreyl's user avatar
1 vote
0 answers
89 views

I have a 2D controllable rocket for which I want to plot the parabolic motion. Additionally, the parabola should be able to change due to the thrust of the rocket accelerating it in either direction. ...
confused_aspirant's user avatar
0 votes
1 answer
208 views

I'm launching a ballistic projectile similar to this sample. The projectile moves from the launch point to the target point, but it's too slow. When I try to increase the speed without changing the ...
QuestionAndroid's user avatar
0 votes
0 answers
80 views

I'm recreating the SaturnV rocket to-scale in Box2D, which so-far involves 3 very massive rectangular bodies stacked on top of each other (1-2 million kg each). Box2D advises not to use such high mass ...
confused_aspirant's user avatar
0 votes
1 answer
286 views

After creating a few bodies and a map with collisions, the app performance clearly goes down. However, RAM and CPU don't seem fully stuck, but the game experience is horrible nonetheless. GameScreen ...
ognevo's user avatar
  • 1
0 votes
1 answer
248 views

I'm using Box2D 2.4.1 and trying to get a spring effect between two bodies. No matter how I change frequency or damping ratio with the Distance Joint, I see no effect.. Here's my setup ...
swee's user avatar
  • 11
2 votes
0 answers
104 views

In vanilla Box2D various types of Joints can be used to connect two rigid bodies together. The LiquidFun extension brings the Particle Module, but I was unable to find a way to connect a particle/...
Simon Zvara's user avatar
0 votes
0 answers
150 views

I've been developing my own game engine for the past few days and it's time to add physics. But before adding it in the editor itself, I opened a separate project and tried box2D with SDL2. I always ...
Anuhas's user avatar
  • 31
1 vote
1 answer
178 views

For context, this is inside my custom 2D game engine. Inside the editor code, when the 'play scene' button is clicked, the scene creates it's b2World and then ...
YamMan's user avatar
  • 49
0 votes
0 answers
117 views

I have a problem with Box2D when 2 dynamic bodies fall onto a static body located below when their restitution is non-zero. They tunnel through each other instead of a rigid elastic bounce. If I treat ...
Simon Zvara's user avatar
1 vote
0 answers
63 views

I need help to use an updated Box2D library where the current version is > 2.3.0. I am unable to find a compatible library and do not know how to compile one for use with the Java Native Interface (...
Ankit Agarwal's user avatar
0 votes
0 answers
123 views

Recently I added p_pBody.body->SetLinearDamping(8.0f); code to my player's instantiate code to prevent my player from sliding after I move right or left. Now the ...
Bagbaq's user avatar
  • 1
0 votes
1 answer
95 views

I would like to use pybox2d's Framework class to visualize the simulation. However, the default screen / windows size is 640 x ...
Gilfoyle's user avatar
  • 111
0 votes
1 answer
79 views

I would like to create two objects of different density and (inelastically) weld them perpendicular together, so that the final object forms an L. Afterwards, I want to be able to assign a position ...
Gilfoyle's user avatar
  • 111
0 votes
1 answer
147 views

I'm working on a small platform game using box2d. When I create the game's objects I store them inside a vector. One for dynamic bodies and one for static bodies. ...
Tal Brodkin's user avatar
0 votes
1 answer
98 views

I'm working on a simple platform game. I have the player - a dynamic body, which moves by ApplyLinearImpulse. Generally it works very well, but sometimes the player ...
Tal Brodkin's user avatar
0 votes
1 answer
313 views

I working on a game project using C++ with SMFL and Box2d. I'm basically recreating the game "Jump and Hover", a simple platform game. In the game ther is an platform thats "hovering&...
Tal Brodkin's user avatar
0 votes
1 answer
443 views

I have seen multiple contradictory articles on this topic. Have been trying to implement the Should the function call ...
Ian's user avatar
  • 3
0 votes
0 answers
210 views

In my game, which implements the network functionality with Kryonet, I would like to send a class ("MyBox2DComponent") over the network which e.g. contains a field of type Body (Box2D). Of ...
EchtFettigerKeks's user avatar
0 votes
1 answer
146 views

I am working on a particle simulation using Box2D with Processing. The setup: I generate 4 kinds of particles that exist in equal amounts (for instance 200 in total, 50 each). They are (for now) ...
wo_ste's user avatar
  • 11
0 votes
0 answers
375 views

I'm developing a client/server multiplayer game. in server side i need prevent players cross map objects like walls also i need prevent player go inside each others, instead want to slide them along ...
Mamad R's user avatar
  • 113
2 votes
0 answers
178 views

I would like to implement a "rail joint" in Box2D: a joint which lets a body move only along a given curve. I couldn't find anything about defining custom joints. Is it possible at all ...
Blue Nebula's user avatar
0 votes
0 answers
73 views

I have created a kind of framework for a game that combines box2d and sfml. All game scenes are stored in the Game class. The scenes also contain information about static and dynamic objects: ...
slverwolf's user avatar
2 votes
1 answer
3k views

Many guides used userData. But with the source of Box2d I have, I don't see the SetUserData functions in the code as I see them in the guides. After understanding ...
slverwolf's user avatar
0 votes
1 answer
157 views

I would like to use Box2D to simulate a small world, with entity sizes around 1cm (0.01m), some smaller than that. Box2D's FAQ says twice: Your moving objects should be between 0.1 - 10 meters. You ...
Blue Nebula's user avatar
1 vote
0 answers
126 views

I have an object pinned against the ground by a revolute joint. A motor on the joint makes the object spin. Sometimes the object becomes stuck pushing against a static body. When it happens the object ...
Blue Nebula's user avatar
1 vote
2 answers
401 views

I have a physical simulation on the streets of a city. The simulation is 2D but in a few points it could develop on multiple "layers": for instance bridges or underground tunnels. I may have ...
Blue Nebula's user avatar
1 vote
2 answers
255 views

In the void of space, a spaceship releases a rectangle shaped space-torpedo. In half a second, it starts its rocket engine and goes straight until something get in its way, and then boom! The code ...
Alex CB's user avatar
  • 386
1 vote
0 answers
447 views

Whats the best way to be rendering the locations of objects in box2D in such a way that there no stuttering on movement beyond 8-directions. I'm looking to have object strictly snap to the pixels but ...
Aardhyn's user avatar
  • 11
1 vote
1 answer
594 views

I tried to set up a test demo to see if Box2D physics are working. It works, but I have one small problem: I cannot seem to get the dynamic b2Body to fall faster. I ...
WHofstra's user avatar
0 votes
0 answers
127 views

I'm writing simple AI genetic learning for a 2d car. To do so I need sensors surrounding my car so I can get distance to closest obstacle in every direction. (Picture 1) Picture 1: I need every of the ...
Grzegorz's user avatar
0 votes
3 answers
1k views

I have a system where 2D physics objects are spawned, and I need to know when they spawn outside of a region defined by a box collider set to "is Trigger". Using ...
arcadeperfect's user avatar
1 vote
0 answers
88 views

I would like to create a top down view scene, with one rectangle (top) is on top of an other (base). There is a joint, where ...
Iter Ator's user avatar
  • 277
0 votes
1 answer
101 views

I'm using Cocos Creator with (built-in) box2d for physics. Recently our game behaves weirdly on our new device Galaxy S20 Ultra 5G - which has screen size = 1440 x 3200 - frequency = 120Hz. After stop ...
David Tran's user avatar
2 votes
1 answer
437 views

I would like to calculate position of physics body after some time because of predicting shots trajectory in my game. I found some great answer here where Iter Ator provides equation to calculate ...
Jiří A.'s user avatar
1 vote
4 answers
516 views

In this scene, the object becomes invisible and then comes back In this scene, the object becomes invisible but does not come back Is there any way I can tell if an object will come back when it ...
Sean Carey's user avatar

1
2 3 4 5
17