In this quick start we will get a capsule to float. You can use any other object as long as it has a
For demonstration purposes a primitive sphere will be used (GameObject > 3D Object > Capsule).
WaterObjectcomponent to the object.
Rigidbodyattached, or there are some other setup issues,
WaterObjectwill throw a warning.
Rigidbodyhas a mass of 1 which is way too light for the capsule of this size. Set the
Rigidbodymass to 300.
RigidbodyMassFromChildrencan be added to the
Rigidbodyobject which will enable Material Settings section on the
WaterObject. Here you can choose a
Material Presetor manually set either
Mass(volume will be auto-calculated from the mesh). If one
WaterObjectchildren the mass of that Rigidbody will be calculated as a sum of all child
WaterObjectManagerto any component in the scene, e.g. SceneManager. Exactly one
WaterObjectManagerneeds to be present in the scene. It is responsible for all the physics calculations and the objects will not float without it.
CenterOfMasscomponent to its
Center Of Mass Offsetto (0, -0.5, 0). Green sphere indicates current center of mass. This is important because ships have very low center of mass allowing them to stay upright and Unity calculates center of mass as a center of volume of the collider(s).
There is a quicker way to setup a Water Object than the one above. It is just a good idea to know how to set it up manually first.