All posts about Box2D

Creating a sling with Box2D using joints

This is an example about the creation of a sling using joints and motors. Click the mouse to break the joint and release the bullet. Try to hit the stack of boxes. I used a distance joint, a revolute joint and a motor. The code does not need to be commented because there is nothing […]

Box2D breakout prototype

Porting Breakout/Arkanoid with Box2D seems to be an interesting challenge for developers. Some days ago I showed you Phyballs, now it’s time for Andre Vidal to show his work. Andre runs his own blog I suggest you to visit because you will find some interesting source code. This is Andre’s breakout (arrow keys = left […]

Box2D joints: Prismatic Joints

Time to learn something about Box2D prismatic joints. A prismatic joint provides one degree of freedom: translation along an axis fixed relative to the first body. Relative rotation is prevented. In other words, prismatic joints can be used to represent pistons and other sliding objects. In this tutorial I am going to show how to […]

Box2D: tutorial for the absolute beginners – step 2

After understanding the meaning of the first lines in Box2D: tutorial for the absolute beginners, it’s time to explain the rest of the script. Lines 19-27: These lines handle the debug draw. Remember Box2D does not draw anything, it just calculates position, rotation and motion of every object in the world. So it’s up to […]

Box2D: tutorial for the absolute beginners

This is a tutorial about Box2D dedicated to the absolute beginners. I received a lot of request asking for this, so here we go. What is Box2D Box2D is a feature rich 2d rigid body physics engine, written in C++ by Erin Catto. There is a Flash version called Box2DFlashAS3, but among Flash developers it’s […]

Box2D joints: Revolute Joint – Building motors

After seeing how to create a revolute joint, it’s time to use them to create motors. Box2D already has everything we need to create such motors. The script is the same as the one I showed you in Box2D joints: Revolute Joint, and you just need to add the lines I am going to show […]

Box2D joints: Revolute Joint

After introducing Distance Joints, it’s time to learn something about Revolute Joints. A Revolute Joint attaches two objects by “pinning” them together at an anchor point which they may revolve around. The most interesting thing, that I will cover in another post, is the capibility of making motors out of Revolute Joints. Yes… motors… engines… […]

SamePhysics – My first Box2D game

You are all invited to play SamePhysics, my first Box2D game. It’s a small milestone because it’s my first Box2D game. The game is the remake of SameGame, just using Box2D to manage the blocks. It’s not the greatest game of the year, but developing a full Box2D game made me acquire the experience to […]

Phyballs: when Arkanoid meets Box2D – Full source code

Box2D is getting more and more popular among developers, and I am proud to have the permission to publish the first source code for a complete Box2D game. The author is Esteban Gallardo, author of Free Creation Games. The game is called Phyballs And this is the source code. I have to say, this is […]

Drawing circles on the fly in Box2D

Only a day after Drawing boxes on the fly in Box2D I got three submissions for drawing circles on the fly. I will list all of them, and I found interesting how different Flashers obtained the same result in quite the same way. The first to send the routine was Vitaliy Berov: This is the […]