Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Box2D/SFML Fun!

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
465 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jun 23, 2011

I was playing with Box2D today (and a little yesterday, but not much).

(Sorry about the double cursor, I fixed it after recording the video, so now you just see the cat cursor. :P)

This video has the 4 (not counting the blank one) tests.
1. A Single Box
2. Bouncy Ball
3. Pulley Test
4. Chain Test

I started out with A Single Box, and had some trouble because I didn't know b2PolygonShape::SetAsBox took half the size, not the whole thing. (Even though it was right there in the documentation...)

Once I figured that out, it was pretty easy to make Bouncy Ball.

Then, I based Pulley Test and Chain Test on two different entries in Box2D's official testbed.

The pulley wasn't a whole lot, I mostly did just the graphical part. For the chain, I had to figure out how to attach a ball to the chain (which also wasn't hard).

(The balls weren't a mask or anything, just an image in the shape of a circle.)

Source code: http://spacechase0.com/box2d/Box2D_Testbed_Source.zip

The black cat is mine, and the calico one is one of my brother's. :P

SFML: http://www.sfml-dev.org/
Box2D: http://box2d.org/

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (123spacechase)

  • Can i get source please :O ?

  • @Anro900 It's near the bottom of the video description. :)

  • hey can you pls send me the source code, i cant match Box2D's physiques with SFML's rendering ^^

  • @zaglet Sure.

    One of the problems I was having was that Box2D takes half the size (which sorta makes sense, since the origin is the center), not all of it. I did some nasty hacks to make joint drawing more automated, too. (Example: Box2DTest::DrawWorld)

    (Added zip to video description.)

    In particular, you may want to look at Box2DTest.h/cpp and SingleBox::AddBoxBody. Chain::AddChainBodies may be interesting, too. (Although a bit confusing. :P)

    (Need more characters!)

see all

All Comments (5)

Sign In or Sign Up now to post a comment!
  • @123spacechase oh Thanks a lot

    Thanks man for ur response u rock, i ll take a look.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more