# [ODE] objects in water

Tyler Streeter tylerstreeter at gmail.com
Wed Jan 19 08:50:02 MST 2005

```> 1. Although amount of force does not increase as you go down
> in depth its good to set some interpolation to 1.0 fraction of force.
> Why is that? As your sampling point enters the water surface you
> get suddenly a big (comparatively) force applied to your body and
> vice versa. Results in juddering. To solve that I choose some limit
> distance depending on the body and apply force proportional to
> the penetration distance where at the limit distance  (and deeper) the
> force is fully applied.

Yes, that makes sense.  I think if you use a very small force per
(underwater) sampling point, it might help, though I'm not sure if it
would ever stop oscillating on the surface.

> 2. When body is partially in water it is not clear how exactly the
> damping (and forces) is applied as it would depend on the amount
> of body that is in the water. In some cases my penetration distance
> interpolation handles that. But here are some cases where the
> sampling points penetrating need to be treated as special contacts...
> Example: you throw a box at a good speed almost horizontally
> (parallel to water surface) in reality when it touches the surface it is
> likely to spin and jump up... so the forces are not always opposite to
> gravity.

The amount of the body that is in the water is related to the number
of underwater sampling points.  So you would add a small damping force
for each underwater sampling point.  This should work for the case you
mentioned with the horizontal box motion: the part of the box that
hits the water will get a damping force opposite to its motion, yet
the rest of the box above water will not have this damping force.
This should make it spin (and jump up, due to buoyancy) as you
mentioned.

> Your approach in particular with the averaging the sampling points
> distance is not quite going to work for cylinders as they are have
> no damping spinning over their length axis and quite a bit of damping
> if angular velocity is along other axis.

That is a major limitation.  My method would use the same linear and
angular damping regardless of which direction the object was moving.

> I was thinking of may be using the normals of the sampling points
> as well and the body velocity at these points to derive an approximation
> damp force.

That should work.  I think Karl Sims
(http://www.genarts.com/karl/evolved-virtual-creatures.html) did
something similar for his swimming creatures.  Since he only used
boxes, he just used the surface area and normal of each face.  For
other shapes (e.g. spheres and cylinders), you might need to use the
sampling points for curved surfaces.

Tyler
```