[ODE] Demo of buoyancy and ODE
Mattias Fagerlund
mattias at cambrianlabs.com
Fri Feb 7 09:14:02 2003
Hi! I've created a demo of buoyancy code for ODE, the demo can be
downloaded here;
http://www.cambrianlabs.com/Mattias/DelphiODE/BuoyancyParticles.htm
the delphi source here http://www.cambrianlabs.com/Mattias/DelphiODE/
Buoyancy physics may seem trivial, the body is effected by two forces,
gravity at the center of gravity and buoyancy at the center of buoyancy.
The size of the buoyancy force is proportional to the volume of water
that it displaces (f=V*g*WaterDensity). But calculating how much water
is displaced by an arbitrary shape is far from trivial. Even worse,
calculating the center of said displacement volume.
I've taken a particle based approach to the buoyancy calculations, the
shape is aproximated by buoyancy particles (henceforth called bobbies).
Bobbies don't have mass or inertia, ODE takes care of that. Bobbies
create buoyancy forces and drag when they're submerged in water. When
they're not, they're dormant. A Bobby then applies it's forces to the
ODE body that the bobby is attached to.
The Bobbies have a radius and a drag constant. The radius is used to
determine how much of the bobby is submerged, and where the buoyancy
center is located. The drag effects how much a bobby is hindered by
water. Only exterior Bobbies should have drag, internal ones would
typically be shielded by the exterior ones, though this isn't currently
simulated. Bobbies should also have a normal that determines in what
movement directions they have drag, this isn't simulated either. Both
are trivial to code (I need a cool editor first, though).
I have some physics questions surrounding this, I think my simulation is
a good aproximation (looks good to me anyway), but I fear I've cut some
corners;
When a sphere is submerged under a flat body of water, the buoyancy
force is directed straight up. When the body of water is tilted (due to
wave action), the buoyancy force is effected - sphere heads for the
surface, but I can't tell by how much :( Right now, I send the bobby
heading for the surface the shortest possible route, and that's probably
a fair aproximation at small water tilts, but is it correct?
Any sources of information about boyancy and particles would be highly
apreciated.
If you have any comments, I'd love to hear them!
cheers,
m