3
votes
0answers
97 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 ...
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
1answer
50 views

How to move a body from one world to another?

I have a Box2D world for each level in my game. When a level is completed, I want the player to be removed from the completed level's world and added to the next level's world. How do I do this?
1
vote
2answers
72 views

Box2D `ApplyLinearImpulse` is not working whereas `SetLinearVelocity` works

I need to mimic jumping behavior for the player in my game. Player consists of two fixtures with circle and rectangle shapes. Rectangle I use to detect ground and it is a sensor. Is some point for ...
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 ...
1
vote
1answer
409 views

Scrolling with SDL2 & Box2d - My Camera isn't keeping up with my player

I'm trying to get a game on the google play store before I'm 40 (long held dream to publish a game since the days of the speccy), I have just over a month to go so it's not looking good! Foolishly I ...
0
votes
2answers
113 views

Floating point precision issue with Box2D

I'm using Box2D and I am putting edge tiles as b2Bodies so that the tile world can have physics: The problem is that there are 3 b2_kinematic bodies under the player right beside each other. Every ...
0
votes
3answers
216 views

How do I prevent other dynamic bodies from affecting the player's velocity with Box2D?

I'm working on my player object for my game. PhysicsBodyDef def; def.fixedRotation = true; def.density = 1.0f; def.position = Vec2(200.0f, 200.0f); def.isDynamic = true; def.size = ...
2
votes
1answer
188 views

Using Box2D / Physics with Tiles?

Here is my issue. I currently have Box2D setup and working. But, it works with my Entity system. So I can create static objects and dynamic moving ones, and they simulate fine. However, my world is ...
0
votes
1answer
513 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
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 ...
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 ...
4
votes
1answer
485 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 ...
-3
votes
1answer
407 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?
3
votes
1answer
400 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 ...
2
votes
1answer
124 views

Efficiently storing game states history for physics?

I would like to store the history of a box2d simulation. Currently I can't find any built-in mechanism for that. I need to store the states of all non static objects in the last second, mainly for ...
5
votes
3answers
259 views

What could cause a sudden stop in Box2D?

I'm using Box2d for a game, and I have a bug that's driving me nuts. I've simplified the situation down to a square player sliding back and forth frictionlessly on top of a floor composed of a series ...
0
votes
1answer
161 views

How to get the Exact Collision Point and ignore the collision (from 2 “ghost bodies”)

I have a very basic problem with Box2D. For a arenatype game where you can throw scriptable "missiles" at other players I decided to use Box2D for the collision detection between the players and the ...
1
vote
1answer
690 views

Check for bodies within a specific circle in Box2D

I'm trying to find positions to insert new bodies into my world. For that, I'd like to have a "free" spot where this body wouldn't overlap with anything else. So my plan was to sample "random" ...
1
vote
1answer
498 views

How to fake flipping a skeleton in Box2D?

Imagine I have a skeleton — that is a set of bodies held together through various constraints and joints — and I want to flip it. Bodies cannot be flipped in Box2D, so how can I fake that? ...
5
votes
2answers
315 views

Rectangles render with gaps in between them (Box2D)

Right now I create my boxes where 1 meter is 85 pixels. Gravity is 10. And fixtureDef.restitution = 0.1f; fixtureDef.friction = 0.5f; ...
2
votes
1answer
604 views

Setting the Box2D gravity for a pixel coordinate game?

I'm making a game with Box2D with a top left coordinate system. I multiply positions by an M_TO_PX_RATIO of 10.0f to convert from meters to pixels. I noticed that when I set gravity to 9.8, the ...
2
votes
2answers
601 views

2D AI Engines/ Resources?

i'm wondering if there's any 2D AI source code or engines out there. I'm inspired by the Euphoria engine, and want to use whatever is already out there to make something like it in 2D, where the ...
7
votes
6answers
417 views

Determining player.isFalling() through change of y?

I'm currently using Box2D and my character is a bunch of fixtures in Box2D. I was wondering if, to determine if a player is falling, detecting a change in Y position would be appropriate? Are there ...
7
votes
2answers
4k views

Is it worth it to use Bullet for 2D physics instead of Box2D for the sake of learning Bullet?

There isn't much more to the question. I'm not concerned about overhead, as I'm sure they are both fine for my purposes. Basically, I am familiar with Box2D concepts because of the Farseer Physics ...
8
votes
1answer
428 views

How can I copy or back-calculate definitions for an entire b2World?

I'm working on a platformer where I'd like to be able to move or copy bodies between multiple Box2D b2Worlds. The desire has cropped up three times now - moving objects between documents in my editor, ...