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/
Can i get source please :O ?
Anro900 1 week ago
@Anro900 It's near the bottom of the video description. :)
123spacechase 1 week ago
hey can you pls send me the source code, i cant match Box2D's physiques with SFML's rendering ^^
zaglet 7 months ago
@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!)
123spacechase 7 months ago