strange character controller falling

this one is a bit odd. I’m new to character controllers so i have no idea what is happening I wrote a script but i don’t really think you’ll need it to understand my problem.

notice i use simple move to move my character around, it works great until he falls off the edge of a platform.

the character sometimes falls off normally, but other times he falls super far, around three times as far to be exact!

i can’t explain it, but i know that i cant have that happening all help is apprecieated

here’s my script, again i won’t think you’ll need it (i only stress that because i never read peoples questions who barf 100 lines of code)

var movespeed = 30;
var airtime = -1; // used to find out how much longer to lerp
var jumphieght = 10;//just in case we add like a "high jump boots item;
var jumptohieght = 0; //the hieght to jump from which they are right now
var controller : CharacterController;
controller = GetComponent(CharacterController);
function Update () {
//simple movement

		if(Input.GetKey(upkey)){
			controller.SimpleMove(transform.forward *  movespeed * Time.deltaTime);
		
		}
		else if(Input.GetKey(downkey)){
		
			controller.SimpleMove(-transform.forward *  movespeed * Time.deltaTime);
		
		}else{
		
			controller.SimpleMove(Vector3(0,0,0));

		
		}
		if(Input.GetKey(rightkey)){
		 
			transform.Rotate(0,120 * Time.deltaTime,0);
		
		}
		if(Input.GetKey(leftkey)){
		 
			transform.Rotate(0,-120 * Time.deltaTime,0);
		
		}
		if(Input.GetKeyDown(jumpkey) && controller.isGrounded == true){
			airtime = 10 ;
			jumptohieght = jumphieght + transform.position.y;
			
		}

	if(airtime >= 0){
	airtime += -1;
	
	transform.position.y =   Mathf.Lerp(transform.position.y, jumptohieght, 0.1);
	
	}
}

i figured it out, so i’ll post the answer here for anyone else who happens to have this problem (which it sincerely surprises me that i haven’t seen anyone else with this problem around the web.

my problem was on line 11

controller.SimpleMove(transform.forward *  movespeed * Time.deltaTime);

this essentially moves the character forward. Time.deltaTime is used to make everything move at a uniform rate on all computers.

It does’t make the rate uniform, but rather, moves the controller faster when the frames are longer. But, if the character jumps or falls of a ledge, physics take over. the physics will move the character at a good speed from the very last point he moved (in this case the moment before he jumped or fell).

this means that if the frames speed up or slow down the character will move faster or slower than normal for just an instant, but if that instant is right before when you jump or fall you will keep that speed for the duration of the fall, so you could go really far or hardly move at all.

So I can’t use Time.deltaTime

to resolve this all i had to do is put the code in a fixed update, where things will move in at a fixed rate and increasing speed will not be necessary