- Home /
WATER....WATER....I NeeD WATER...help me x.x
Hey In all seriousness I need help to create basic water that's mildly realistic without the pro version. I know that you can somehow do it with the prefabs in Standard assets, but I have no idea how I've been experimenting with it for about four hours and still haven't gotten it. Can someone point me in the right direction? Also if you can help me understand how to make underwater effects like it getting darker under the water and it diffusing the vision just a little.
I am making now two games one a free multiplayer post-apocalyptic rps XD
All help will be greatly appreciated as always, Tracey Pitloun the NEwB of Unity
Answer by Tracey P · Feb 27, 2011 at 03:19 PM
Ok Ive fixed it with the help of WesleyE. What I did is I set up a box collider underneath the water plane and named it underwater and then applied my code to it which is:
//set your varibles here.
var fog = false;
var fogColor = Color (0, 0.4, 0.7, 0.6);
var fogDensity = 0.04;
var skybox : Material;
//this is where you go underneath the water or in this case into the trigger aera
//this is just the effect not anything to do with force.
function OnTriggerEnter(other : Collider) {
fog = true;
RenderSettings.fog = fog;
RenderSettings.fogColor = fogColor;
RenderSettings.fogDensity = fogDensity;
RenderSettings.skybox = skybox;
}
//this is where we are exiting the water and the effect of being underneath the water is ended.
function OnTriggerExit(){
fog = false;
RenderSettings.fog = fog;
}
Answer by Tracey P · Feb 27, 2011 at 02:15 AM
Hey never mind it was so simple all I had to do is put it in there lol and I found a previous question that has a script that allows me to make the underwater effect thanks anyway :D
Still need help with underwater effect because the script I made isn't working as I want it
Answer by Tracey P · Feb 27, 2011 at 03:09 AM
The script for underwater I am using now is
var fog = false; var fogColor = Color (0, 0.4, 0.7, 0.6); var fogDensity = 0.04; var skybox : Material;
function OnTriggerEnter(other : Collider) {
fog = true;
RenderSettings.fog = fog;
RenderSettings.fogColor = fogColor;
RenderSettings.fogDensity = fogDensity;
RenderSettings.skybox = skybox;
}
the problem now is that when I leave the water it keeps the effect on Any Ideas On how to fix this
Use the onTriggerLeave function to restore the fog when you exit the trigger area.
It needed a function OnTriggerExit() //then fog = false; RenderSetting.fog = fog;
somebody tell this guy the freaking difference between comments, answers and edits
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Water effect 0 Answers
Trying to simply play this animation... Help please. 1 Answer
gun bob and jerk animation 2 Answers
After played an animation how to update character position? 2 Answers