Quote:
1) The objects seem to float upward pretty well and spin, but don't seem to be pushed left or right. Why is this?
They should get pushed to the left and the right... The code for the interactions between the fluid and the objects is held together with chewing gum and prayers though, it's been a major source of headaches and I still don't know how to get it to work properly
Quote:
2) I noticed an odd bug...
Oops, yes, I found and fixed that shortly after posting the code. I'll maybe post up the changes when I get a chance (I'm not on the machine which I code on at the moment)
Quote:
3) (performance stuff)
I'd expect applyLiquidConstraint to take up something like 50% of the processing. Box2D is hardly doing any work at all in the test (just some static geometry, one movable body which gets a couple of forces applied to it by the fluid, and a bunch of AABB tests), whereas the fluid code is still going to be quite complex and expensive. I plan on looking into it some more, because I'm sure that there are still some optimisations that can be made, but applyLiquidConstraint is always going to be expensive. It's called exactly once per frame at the moment (I don't think calling it less than once per frame is a good idea), and it's not an iterative function, so the iterations can't be turned down.
Quote:
4) You seem to have forgotten to post FluidDefs.h. Only seems to be missing b2Random.
oops, FluidDefs.h was something that I've used to have some common stuff shared between a few different versions of the fluid test (nParticles, the grid dimensions, the particle structure itself). For the code I uploaded, I copied all of the contents of FluidDefs.h straight into FluidTest.h, so you just need to remove the #include "FluidDefs.h" (I forgot to). As for you not having b2Random - um, I think maybe you should have that already? it's part of Box2D, as far as I know (unless I've ended up with some wacky version of box2d that someone else has added b2Random to, and it doesn't exist in the main versions...)