Fluid Volume?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
SKAUGHT
Posts: 2
Joined: Fri Dec 18, 2009 6:09 pm

Fluid Volume?

Post by SKAUGHT »

Hello,

First off I'm new to game programming/XNA, my ultimate goal is to make a hydroplane sim/game, but I'm just trying to figure out some physics stuff first and I decided to give the BEPU physics engine a try. Anyway, water would be an integral part of the sim and I noticed buoyancy stuff was implemented in BEPU, but I can't find any info on the Fluid Volume. I've got no clue how to set it up, I was wondering if there was any example code or anything for the fluid volume?

I assume its something that gets added to space, but I tried creating a fluid volume object and it didn't appear to work correctly as nothing showed up and the blocks I had placed just fell through space.


Thanks,

Skaught
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Fluid Volume?

Post by Norbo »

An example implementation of the FluidVolume can be found in demo #25 in the demos project.

Basically, you create a set of triangles that represent the surface of the water, hand them to a FluidVolume along with the other configuration settings, add the volume to the space, and it should work.

The other configuration settings include position, surface normal (usually Vector3.Up since gravity points down), fluid depth, fluid density, fluid damping, and fluid sample count. The last fluid sample count parameter is used to configure how many points along each dimension are tested against floating objects. Having lots of samples will produce a more realistic buoyancy effect, but having too many will quickly overwhelm the CPU.
SKAUGHT
Posts: 2
Joined: Fri Dec 18, 2009 6:09 pm

Re: Fluid Volume?

Post by SKAUGHT »

Ah thanks!

I completely overlooked the demos in the Downloads section. Yeah, I think I got most of the parameters right except I think I screwed up the list of triangles.

I'll give it another go tonight.
Post Reply