- Home /
Question by
Wesley21spelde · May 16, 2014 at 09:16 PM ·
blur
Water Blur??Doesnt work
Hey Guys i have this script that Creates a underwater look but not everythinh works fine i encounterd 2 problems 1. the blur component doesnt do anything and yes i have it attached to my pleyers camera 2. Is it possible to Turn off the Players Gravity When its underwater?? 3. The Player Got a Rigidbody And a Character Motor Script attached to it here is the script
var WaterLevel : float;
var useGravity: boolean;
var Player : GameObject;
var blur :Blur = Camera.main.GetComponent(Blur);
var useBlur : boolean;
var Bubbels : GameObject;
private var defaultFog = RenderSettings.fog;
private var isUnderwater : boolean;
private var normalColor : Color;
private var underwaterColor : Color;
private var defaultSkybox = RenderSettings.skybox;
var noSkybox : Material;
function Start () {
normalColor = new Color (0.5f, 0.5f, 0.5f, 0.5f);
underwaterColor = new Color (0.22f, 0.80f, 0.80f, 0.5f);
Bubbels.active = false;
blur.blurAmount = 0;
}
function Update () {
if ((transform.position .y < WaterLevel) != isUnderwater)
{
isUnderwater = transform.position.y < WaterLevel;
if (isUnderwater) SetUnderwater ();
if (!isUnderwater) SetNormal ();
}
}
function SetUnderwater()
{
//The Bubbels are a particle renderer Attached to The Player
Bubbels.active = true;
RenderSettings.fog = true;
RenderSettings.fogColor = underwaterColor;
RenderSettings.fogDensity = 0.12f;
RenderSettings.skybox = noSkybox;
blur.blurAmount = 1;
}
function SetNormal()
{
Bubbels.active = false;
RenderSettings.fog = defaultFog;
RenderSettings.fogColor = normalColor;
RenderSettings.fogDensity = 0.03f;
blur.blurAmount = 0;
}
Comment
Your answer
Follow this Question
Related Questions
How to add motion blur effect to your camera 1 Answer
access DOF values via script 1 Answer
default script editor now working anymore 0 Answers
Setting up health script. will not work, 1 Answer
Scripting error! 1 Answer