Example #1
0
        /// <summary>
        /// Checks if the position is below the maximum possible wave height. Can be used as a fast broad-phase check, before actually using the more expensive SampleWaves function
        /// </summary>
        /// <param name="position"></param>
        /// <param name="waterObject"></param>
        /// <returns></returns>
        public static bool CanTouchWater(Vector3 position, WaterObject waterObject)
        {
            if (!waterObject)
            {
                return(false);
            }

            return(position.y < (waterObject.transform.position.y + WaveParameters.GetMaxWaveHeight(waterObject.material)));
        }
Example #2
0
        public static float GetMaxWaveHeight(Material mat)
        {
            if (!mat)
            {
                return(0f);
            }

            if (WavesEnabled(mat) == false)
            {
                return(0f);
            }

            return(WaveParameters.GetMaxWaveHeight(mat));
        }
Example #3
0
 /// <summary>
 /// Checks if the position is below the maximum possible wave height. Can be used as a fast broad-phase check, before actually using the more expensive SampleWaves function
 /// </summary>
 public static bool CanTouchWater(Vector3 position, Material waterMaterial, float waterLevel)
 {
     return(position.y < (waterLevel + WaveParameters.GetMaxWaveHeight(waterMaterial)));
 }