This project has moved and is read-only. For the latest updates, please go here.

FluidDragController issues.

Topics: Developer Forum, Project Management Forum, User Forum
Oct 4, 2010 at 6:14 PM

Hey, I've been trying to use the FluidDragController, and I noticed a pretty big issue with it acting strange with things other than boxes.  When I spawn say concave objects, the behavior is really....'wonky'.  I think this is a problem with how the code itself is implemented.

Looking into the code, I noticed that force is applied to the area of the intersecting vertices.  This seems wrong.  A simple box (with just 4 verts) won't work as intended as the whole box must be submerged for any force to applied to it.  It will then have a crazy bobbing action, sinking all the way, then bouncing almost out of the water, then sinking until it is completely submerged again, only to bounce almost out of the water.  A concave polygon's behavior in this case also seems to be completely undefined.

It seems like the solution would be to use the area of the actual polygon through intersecting the line segments of the volumes and not just cheating by looking up the intersecting verts.  This seems somewhat simple with the AABB fluid controller...

Has this been brought up before?  Do you guys have a plan on improving the FluidDragController?  Or am I left to my own devices to make this work (and submit a solution to you guys)?

Oct 4, 2010 at 10:03 PM

I've removed the FluidController from 3.0 because it was acting strange together with the wave generator, so it is a long time since I've taken a look at it. As I remember it, it finds the vertices submerged in the container (AABB container as example) and create a polygon using those vertices, then it calculates the area and provide an upward force on the polygon using the submerged area.

It should be working fine in 2.0 and the problem you describe has not been mentioned before. Have a look at the water sample in 2.1.3.

I do have plans to work on the fluid controller in 3.0. I'm just not sure if I should implement the one from 2.1.3 or go for an alternative. It is very low on the list of things to do tho.

Aug 27, 2011 at 11:13 PM

I want to say I think it's pretty lame this was just removed. I fell in love with the Farseer Games that use this controller at such as Tire Storm and Water Demo. Realistic water with waves in 2d physics engines is rare and seeing it in the Farseer Games demo is the sole reason I switched over; and then i find this.

I am so determined to get water working that I'm re-integrating the water stuff from 2.1.3 into 3.3.1 as we speak, but I'm afraid with all the changes since 2.1.3 that it's going to be a total failure getting everything ironed right.

I think this is one of those things that would have been perfectly understandable to leave in the code with a big bold comment at the top warning of it's instability. This way all of the inner working keep up with the latest changes, but possibly allows very dedicated people to get dirty and find the issues with the quirkiness. I'm just saying, I would have made it my sole priority in life to figure it out.

I see now there is a buoyancy controller in place of the previous water stuff that looks to be similar to box2d's buoyancy stuff. This makes me sad because I came from box2d and was very disappointed with buoyancy because of the lack of waves. No waves are quite boring and I really don't care to fake the waves somehow, especially since waves were beautiful with the FluidDragController.

I realize you probably have a lot on your plate, but I believe it would be incredibly valuable for Farseer to have realistic water again.