Buoyancy Support?

Game_Ender

13-02-2007 04:56:37

I am currently using OgreNewt because of its out of the box support for buoyant objects. Does PhyX and NxOgre have anything like that? Can I just set a plane for water and tell it that this body should be buoyant?

betajaen

13-02-2007 09:41:01

PhysX does support liquids except for fluid planes aren't supported out of the box. But I'm sure you can come up with something using a trigger.

Game_Ender

13-02-2007 16:19:07

What do you mean by liquids? Do you mean I can define a volume and call it water (with the right density), and then other objects that enter that volume will be affected by drag and buoyancy? I am trying to simulate a submarine.

betajaen

13-02-2007 17:30:32

No, the liquids that PhysX simulate are real-time liquids such as running water, blood splatter, etc.

Simulating an ocean, or even a swimming pool with such things would grind your computer to a halt.

A trigger volume would be more suitable, you can simulate buoyancy using forces quite easily. I don't know the math for it, but there should be something on the internet.

Game_Ender

13-02-2007 20:19:08

That's what I thought you meant about fluids. In Newton you just tell it that this body should have a buoyant force added to it, then the basic properties of the fluid and where the buoyancy plane should be.

Calculating the buoyant force is very easy the hard part is determining how much of the body is below the plane of the water and what the center of the submerged portion is. Can NxOgre/PhysX help with that part?

betajaen

13-02-2007 20:29:22

The first seems to be a simple vector calculation, and the second just seems to be converting the centre of mass of the bodies to it's global position. So in theory, yes ;)


If you manage to pull it off. I would be most interested in your results.

Game_Ender

13-02-2007 21:47:40

Are you sure its so simple? The buoyant force on a body is applied at the objects center of buoyancy, this is not necessarily the center of mass of an object. For example if just the corner of a box is submerged you have two forces acting it on (neglecting drag):
* Gravity at the boxes center of mass
* The buoyant force (equals FluidDensity * VolumeSubmerged * Gravity) acting at the center of that submerged volume.
This is what causes a floating object to level out once it submerges. If you don't do this you will have boxes that just kind of sit at odd angles.

Now for a box finding the volume of submerged area and finding its center might be easy, but I don't where to start for things like convex hulls. Not trying to beat a dead horse here, I will just take a look at the PhysX api and see if it has anything to help.

betajaen

13-02-2007 22:15:19

You seemed to describe it to be ;)

Anyway, working with the shapes. There are a few functions you may find useful i.e. NxShape::checkOverlapXXX. There are also intersections to help.I noticed the NxUtilLib may be useful too.

You'll have to forgive my ignorance with this subject, as I'm completely clueless. ;)