And one more thing, the line that calculates the distance is actually this
b2Vec2 d = body2->GetWorldCenter() - body1->GetWorldCenter();
Otherwise you get a negative gravity controller (repulsor beam? 🙂 )
Hey Boris,
That's a piece of neat, succinct code you've got here!
I liked the pattern from the moment I saw it, and that's why I didn't try to write my own code (which I would rather implement on my game logic level, and it wouldn't be reusable).
Don't be so cross! Be happy to have testers!
😉
Oh, I"m not cross. Just testing and debugging is tedious at the best of times (e.g. when someone else is doing it for you), which is probably why I didn't do it properly in the first place.
guys can i see source of buoyancy on c++, not ported in flash..