Right my first geeky quick flash experiment…… Skip past the text and take a look at the fun.
A few games I’ve been working on at the mo have required some 2d physics so I’ve been looking at box2d again. The last thing I did with it was “banana cannon” balancing game for Gorillaz Bananaz. Since then actionsnippet.org has packaged up box2d into quickbox2d making it “quick”. It’s worth a look.
Anyway one of the things needed was a nice looking rope/wire effect connecting 2 objects that would allow them to move freely when the rope wasn’t tort. I couldn’t find a single joint that didn’t affect the rotation of the other object while moving around. I’m sure there’s probably a better way, but I managed to achieve the effect by creating a an extra hidden object like a knee inbetween the 2 and applying a distance joint from the knee to each object. Then to cheat a nice bendy/rubbery rope look I drew a line using curveTo going from one object to the other bending towards the knee. Take a look below.
And behind the scenes
I’ve added a post about calculating a point to make curveTo curveThrough a point. It’s how the string curves towards the knee.