How difficult to implement "buoyancy"?

I ran into this article and demo the other day (Windows only):

http://www.cambrianlabs.com/Mattias/DelphiODE/BuoyancyParticles.asp

And I wondered, how difficult would it be to implement this in Unity? Ok, I’m sure I’m showing my complete lack of knowledge on the subject, but I did a search for info on “buoyancy”, “PhysX” and “Particles” and apparently PhysX supports buoyancy and something like this was done with NxOgre (the PhysX wrapper for Ogre). So it sounds like it’s possible, but how difficult would it be to achieve?

There are many ways to do it.

One way which doesnt require any work basically is using physic material springyness.

http://unity3d.com/Documentation/Components/class-PhysicMaterial.html

  1. Create physic material.

  2. Enable useSpring

  3. Set spring to 10 and damper to 1. (you have to tweak those values to feel right)

  4. Then change the target position so that your boat can go into the surface.

  5. Then drag the physic material onto the boat colliders physic material slot.

Done.

Related topic was posted here:
http://forum.unity3d.com/viewtopic.php?t=1980&postdays=0&postorder=asc&highlight=boat&start=15

Thanks Joachim,

I don’t have Unity running yet (my iMac is scheduled to arrive next week) so I’m not able to try this yet, but I’m trying to get a feel for what can be done with Unity in the mean time. When using springs to simulate buoyancy, what “drives” the object’s motion, the surface it’s sitting on? This seems like a very simple solution, but how realistic is it compared to the “particle” method?

Basically the contact points that are used for collision detection will be made springy.

Last time i tried it, it looked pretty buoyant to me. But then i haven’t tried it on a real boat. I think it should work fine. But if not you can always implement it yourself with some raycasting and applying forces.

Thanks Joachim. Still 5 more days to go before my iMac arrives… I’m starting to get excited!