Buyoancy

I’m trying to make a simple rigidbody sphere float over water. Is Unity capable of doing this with it’s Physics engine?

There is no built in buoyancy with Unity’s version of PhysX. It’s usually faked by adding appropriate forces. If you search the forums there’s a myriad of examples of varying complexity/realism.

I was searching VERY long time to find a good buoyancy code. Finally, I found one that simply manipulates rigidbody’s velocity. It doesn’t need any physic material or complex mathemetic formules, but it still looks realistic. After adding several lines of script to it, it now does exactly what I need.
I’ll post it later this day, I’m not on my usual computer…

A long time ago, I did an example of vehicle physics, which includes a boat. May need some adaptions to work in 2.5, but the code may be useful:

http://nilch.com/stump/VehiclesExample.zip

Thanks for the help guys. Klaro, i’ll be waiting for your code. Hope it works good!

Here’s as far as I got on implementing ‘Exact buoyancy for polyhedra’ from Game Programming Gems 6. It’s got some issues but works for the most part.

/P

172899–6208–$buoyancy_133.unitypackage (146 KB)

Anyone play with this package yet?

Yup, worked fine here. I especially liked the current feature.