Simulating Water not working..

My problem is I have all of the physics ratio finished as in relating to the water level and what not.

PROBLEM: when I am “In” the water it freezes but unfreezes when I jump and am not “In” the water. Now how would you guys go about fixing this? (I can’t use rigidbody on my controller so I have to rely on transform.position)

Here’s the script:

var water: Transform;
var self: Transform;
var x = 0;
var ypos;
var waterLevel;
var bouyancy: float;
function Update () {
 ypos = self.transform.position.y;
 waterLevel = water.transform.position.y;
   if(x == 1){


var gravity = GetComponent(CharacterMotor).gravity;

}
 if(x != 1){
    gravity = 20;
     }
  if(ypos == waterLevel)
                {
      gravity = 1;
                }
  if(ypos < (waterLevel - 1)){
            x =1;
            gravity = -4;
                        }
   if(ypos > waterLevel){
            x = 0;
            gravity = 20;
                        }

}

You’re calculating this gravity value, then not doing anything with it (if I read it correctly, but the formatting is horrible, how can you read that?)