- Home /
 
               Question by 
               Nightkilla · Oct 05, 2013 at 04:51 PM · 
                waterunity 4underwateraffect  
              
 
              How to add underwater affect with a script?
I am making a car game, and it's free roam. There is a big puddle surrounded by land, but it is up high. I have been looking for a script but it only determines when to activate the fog by the camera's Y axis. What I need to make it do is when you are UNDER the DaylightWater object, it gives you fog. How do I do this? I am using Unity 4.1.2 latest version.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Cherno · Oct 05, 2013 at 09:58 PM
The easiest way is probably to just give the water body a collider with IsTrigger set to true and then just check not only if the character (who needs a rigidbody) is below a certain y value, but also if he has entered the water (-> OnTriggerEnter()).
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                