Box2D is an open-source rigid-body 2D physics simulation library for games, written in C++.
3
votes
1answer
2k views
sprite display does not match its body in box2d
I found about this using debug renderer. When game starts, everything is in order. But when some collision happens, sprite's rotation is way larger than its body. When sprite and body match is the ...
2
votes
1answer
1k views
how to ignore physics collision of some objects in box2d
I know this sounds silly but I would like some objects to follow physics while others not to collide each other.
I tried to achieve them by setting their position exclusively. But then it will ...
3
votes
1answer
246 views
Why does my ball always bounce perpendicular to walls?
I'm using Box2D.
I think it's something to do with wall's fixture definition, but when a ball goes toward a wall at a 45 degree angle, I would expect it to bounce off at 135 degrees, but it always ...
2
votes
1answer
450 views
How to encapsulate game objects (entities) in Box2d
I am currently learning Box2d, a 2D physics engine within libgdx. But Box2d seems to be in every game framework these days so I am not really talking about libgdx.
I understand Box2d comes with lots ...
1
vote
2answers
488 views
How can I implement a “boost pad” with Farseer/Box2D physics?
I'm trying to implement a boost pad in my XNA game using the Farseer Physics Engine. (This question applies to Box2D too, I would be happy to port working Box2D code to C#.)
By "boost pad", I mean an ...
2
votes
1answer
375 views
Box2D/Farseer - Moving fixtures on a Static Body
I am attempting to create a Pool of Fixtures, in order to reduce memory consumption. My problem is that when I attempt to return a Fixture to the Pool and re-assign its position on the Parent Body, ...
3
votes
4answers
350 views
When connecting a physics engine to another engine, should you do all your logic in the units used by the physics side or the rendering side
I'm currently intergrating pygame and pyBox2D, and am wondering which side is best to try to keep to in terms of game units of size.
Box2D is Meters
PyGame is Pixels
At the moment I am thinking I ...
1
vote
1answer
780 views
Connecting 2D skeletal animation to physics engine
I'd like to use skeletal animations in my 2D game, and since I already use Box2D as the physics engine, I'd like to enable (but not enforce) ragdoll animations as well. I need some help in figuring ...
0
votes
0answers
217 views
Box2D high-level c++ wrapper
Is there a high level wrapper around Box2D out there?
I know that the library isn't exactly very low level as-is, but in my opinion some things in the library could be made more intuitive at the cost ...
2
votes
1answer
707 views
How to detect collisions in AS3?
I'm trying to make a simple game, when the ball falls into certain block, you win.
Mechanics: The ball falls through several obstacles, in the end there are two blocks, if the ball touches the left ...
2
votes
5answers
3k views
Box2D physics editor for complex bodies [closed]
Is there any editor out there that would allow me to define complex entities, with joins connecting their multiple bodies, instead of regular single body entities? For example, an editor that would ...
10
votes
1answer
1k views
Should I write my own physics engine, because of networking integration?
I'm currently developing a top down, realtime, zombie shooter. I'm coding this in Java, using JBox2D as my physics engine. I have been coding the networking this week, and am now up to the physics ...
8
votes
3answers
2k views
How do you do AI path following within a 2d physics engine like farseer/box2d?
I'm in the process of moving a 2d top down game I've been working on into a proper rigid body physics engine like Farseer. Up until now, I had just hacked together my own physics code where needed.
...
0
votes
2answers
1k views
AS3 > Mouse Event not happening?
Background: Trying to make a ball appear in the same location the mouse is positioned. Using Box2D Library. Working on a class file (.as)
Issue: The mouse event does not work (I click but nothing ...
2
votes
1answer
516 views
Moving a big set of box2d bodies in an iOS endless side-scroller game (such as Canabalt)
I am working on an iOS endless-running game (Robot Unicorn, Canabalt, etc). I'm using box2d for the Physics and Collision Checking and cocos2d for graphics.
To achieve the notion of an endless level, ...
0
votes
0answers
807 views
Cocos2d Box2d how to shoot an object inside the screen [closed]
I have the code below :
- (id) initWithGame:(mainGame*)game {
if ((self = [super init])) {
isTouchEnabled_ = YES;
self.game = game;
CGSize size = [[CCDirector ...
0
votes
1answer
360 views
How can I respond to mouse events in AS3?
Background:
Trying to make a simple "drop the ball" game.
The code is located inside the first frame of the timeline. Nothing more is on the stage.
Issue:
Using QuickBox2D I made a simple If ...
1
vote
1answer
441 views
Handling player/background movements in 2D games
Suppose you have your animated character controlled by the player and a 2D world (like the old 2D side-scrolling games). When the user presses right on the keyboard, the background is moved to the ...
2
votes
2answers
436 views
Physics in carrom like game using cocos2d + Box2D
I am working on carrom like game using cocos2d + Box2D. I set world gravity(0,0), want gravity in z-axis. I set following values for coin and striker body:
Coin body (circle with radius - ...
0
votes
1answer
364 views
AS3: StageWidth for BOX2D?
I know BOX2D uses meters, and AS3 uses pixels.
I'm trying to create objects which are limited to the stageWidth.
If I do this variable:
for (var i:int = 0; i<(stage.stageWidth); i++){...}
...
0
votes
1answer
352 views
AS3: limit objects to stage width?
I want to limit the creation of objects acording to the stage width.
My method is the following:
for (var i:int = 0; i<7; i++){
If I put something like this, it won't work
for (var i:int = ...
5
votes
1answer
522 views
How to create multiple balloon bodies in Box2D?
In Box2D, how would I go about making a body that's being lifted by multiple "balloons"? These balloons would have to be able to be destroyed (for example, by a bow and arrow).
0
votes
2answers
468 views
Box2D/Farseer Collision Detection
I am looking for literature - or a simple explanation - on how the Farseer (and for that reason, the Box2D) collision detection system works - specifically the logic that comes after the broadphase ...
1
vote
0answers
409 views
Why are my Box2D bodies disappearing when they collide?
I have a Box2D simulation going on and a system that loads the bodies and its' shapes from a text file definition.
I create a new physics world, i load bodies into it, from one of these files. ...
1
vote
1answer
615 views
How to make box2d mouse joint works similar to box2d setposition
I want to make b2mouse joint working similar to b2setposition, though i know in mouse joint force is applied, so it's not possible to reach the desired point without any delay like setPosition(), but ...
5
votes
4answers
866 views
How to port a game from IPad to Iphone
I just finished developing a 2D side scroll game for the IPad using Cocos2d and Box2d.
Now we want to make an IPhone 4 version of the game, but I'm still not sure what is the best way to do it.
I ...
3
votes
2answers
963 views
Why does my position interpolation code result in “jumpy” motion?
I am developing an android game with box2d and use a fixed timestep system for advancing the physics.
However as I use this system it requires the box2d positions to be interpolates. I read this ...
1
vote
1answer
585 views
Box2d/Farseer how to use the World object?
this question is primarily about farseer but as it is a wrapper around box2d i think it's relevant for both libraries.
I'm in the beginning of developing a simple platform game, and I'm stuck as to ...
5
votes
2answers
2k views
Physics or Time-Based Animation In Corona SDK (iOS) Using Box2D
I am part way through creating a Doodle Jump clone for iOS using Corona SDK. I'm currently using the physics engine (box 2D). It's not a straight clone, but I need the basic principles in place to ...
1
vote
0answers
155 views
Which is the best model to present the destruction of the building in Box2D?
We'd like to create a "world-destruction" game. The problem is in choosing the best model for building destruction.
On my mind the building would be an array of objects( tiles). Each object would ...
2
votes
1answer
1k views
2D physics performance on iPhone/Android using Unity 3D?
I've been looking into making 2D games with Unity. One thing which concerns me is the performance of the physics engine. Since Unity is a 3D game engine I'm going to have to assume it uses a 3D ...
0
votes
1answer
193 views
Is it easy to switch from Chipmunk to Box2D?
Currently I'm doing some prototyping with physics in Python and I later plan to port the code over to C++.
Box2D has some features that I really like so I'd rather use that library instead. The ...
2
votes
0answers
318 views
box2d reset position of falling object not behaving properly
I have been playing with box2d in libgdx and have made a falling ball.
Once the ball lands on the ground I want to be able to reset it to the top with the space-bar key
I have done this:
if ...
2
votes
3answers
2k views
Clean way to detect collision of object with box2d
I have been looking into box2d (in java with libgdx) lately and have been trying to create my own custom bounce effect (I increase the Restitution after the first bounce)
To do this as a test I ...
0
votes
2answers
777 views
How to use the box2d contact listener in android (java port)?
I don't have any idea about the box2d collision detection in android. I googled and got results that suggest to use the contact listener but I don't know how to use it in android java.
0
votes
1answer
407 views
How do I calculate logical velocity / direction?
I have a simple jBox2D (Java) implementation of a world with couple of Circle bodies that at the begining are static.
I want to make them movable when the user touches the circle. But I want them to ...
4
votes
2answers
1k views
Box2D Raycast - Getting position / angle of edge hit
I'm casting a ray in Box2D using b2World.rayCast how can I get the normal of the wall which was hit? Or better yet - the line start and end points?
The information returned is:
Fixture (fixture hit, ...
5
votes
3answers
4k views
How to remove a box2d body when collision happens?
I’m still new to java and android programming and I am having so much trouble Removing an object when collision happens.
I looked around the web and found that I should never handle removing BOX2D ...
1
vote
1answer
464 views
What's the difference with how Box2D and Farseer behave in terms of collisions?
I've ported my engine to iOS and have been using the C++ version of Box2D. Everything runs fine except on collisions, it seems Box2D and Farseer handle collisions somewhat differently.
Anyone know ...
0
votes
0answers
828 views
Multiple spawned objects on collision - Corona SDK
Please help! I'm trying to spawn 5 balls one by one from the sky and have them disappear as soon as they hit the ground or when they hit another user-controlled object that's on the ground. The good ...
1
vote
1answer
1k views
How can I cancel a contact in a b2ContactListener?
To know when contacts happen we can derive from b2ContactListener and implement our own solution which is great. I'm wondering is there anyway we can cancel a contact, that is to say when we hit begin ...
1
vote
1answer
658 views
Bodies are colliding but refusing to rotate in Box2D
I'm running box2d in C++ and hooking it up to C# via p/invoke. All physics stuff occurs in C++.
My problem is that bodes know when they are colliding and do so with great precision. However if I have ...
1
vote
1answer
507 views
Dynamic bodies with Parallax Scrolling
I have an object that has a dynamic body. Currently, I'm setting it's position to follow the sprite when the parallax layer move. After a certain event, the object suppose to fall to the ground. ...
3
votes
1answer
166 views
Where would I update a graphical representation of a b2Body in Box2D's solver?
Hey i'm trying to make a class called BodyRep Which is supposed to use SFML too sync a graphical representation and Box2D Bodies orientation/location.
To do this i plan to ovveride some Box2D ...
3
votes
1answer
712 views
Cutting a body in box2d
After cocos2d, I'm looking at box2d... And I have some questions:
I was wondering how to cut a body into pieces.
How do I determine the intersection point of the body with the cut line?
Create a ...
1
vote
2answers
790 views
Would a box2D sensor fit my needs?
I have a object in my game that when the main character hits it, all I want to do is have the object explode and then notify the character object that a hit has occurred.
Would I use a b2Body and ...
4
votes
1answer
457 views
Issues with Polygon Fixtures in Farseer
I've been working with the Farseer Physics Engine to try and build a simple 2D, sidescrolling game. Creating basic rectangle blocks worked easily enough, but I discovered when I tried to create some ...
1
vote
2answers
1k views
Box2D Platform body not moving player body along with it
I am creating a game using Box2D (Javascript implementation) - and I added the ability to have a static platform, that is moved along an axis as a function of a sine.
My problem is when the player ...
5
votes
1answer
206 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
461 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 ...
