/// <summary>
    /// Returns the water level at given location.
    /// </summary>
    /// <param name="x">x-coordinate</param>
    /// <param name="z">z-coordinate</param>
    /// <returns>Water level</returns>
    private float GetWaterLevel(float x, float z)
    {
        if (dynamicwater)
        {
            Vector3 lpos = Vector3.zero;
            lpos.x = x;
            lpos.z = z;

            return(dynamicwater.GetWaterHeight(water.transform.worldToLocalMatrix.MultiplyPoint(lpos)));
        }
        //		return ocean == null ? 0.0f : ocean.GetWaterHeightAtLocation(x, z);
        return(0.0f);
    }
    void FixedUpdate()
    {
        if (dynamicwater)
        {
            waterLevel = dynamicwater.GetWaterHeight(water.transform.worldToLocalMatrix.MultiplyPoint(transform.position));
        }

        Vector3 actionPoint = transform.position + transform.TransformDirection(buoyancyCentreOffset);
        float   forceFactor = 1.0f - ((actionPoint.y - waterLevel) / floatHeight);

        if (forceFactor > 0.0f)
        {
            Vector3 uplift = -Physics.gravity * (forceFactor - rbody.velocity.y * bounceDamp);
            rbody.AddForceAtPosition(uplift, actionPoint);
        }
    }