How do I include the transform direction when changing move direction?

Hello. I am currently using the FPSWalkerEnhanced Script found here. It has air control, but it stops and moves on a dime. I wanted to add momentum to it, e.g it takes a second to slow down and move the other direction, because I will be using a jetpack in my game. I modified the air control section to the code below.It works great when I am facing straight forward. My problem is that if i change the rotation of my character, it goes crazy, spinning is circles and jerking around. How do I include the rotation in this, so that it will work which ever way I am looking? Any help would be greatly appreciated.
The code did not turn out right on here. It looks better on Unity forum.

if(airControl){
                if (Input.GetAxis("Horizontal") > 0){
                    if(moveDirection.x < 25){
                        moveDirection.x +=(inputX * inputModifyFactor * airAcc * Time.deltaTime );
                        moveDirection = myTransform.TransformDirection(moveDirection);
                    }
                }
                if (Input.GetAxis("Horizontal") < 0){
                    if(moveDirection.x > -25){
                        moveDirection.x +=(inputX * inputModifyFactor * airAcc * Time.deltaTime );
                        moveDirection = myTransform.TransformDirection(moveDirection);
                    }
                }
                else if (Input.GetAxis("Horizontal") == 0){
                    if(moveDirection.x > 0){ 
                        moveDirection.x -= (airDecc *Time.deltaTime);
                    }
                    if(moveDirection.x < 0){ 
                        moveDirection.x += (airDecc *Time.deltaTime);
                    }
                }
                if (Input.GetAxis("Vertical") > 0){
                    if(moveDirection.z < 25){
                        moveDirection.z +=(inputY * inputModifyFactor * airAcc * Time.deltaTime );
                        moveDirection = myTransform.TransformDirection(moveDirection);
                    }
                }
                if (Input.GetAxis("Vertical") < 0){
                    if(moveDirection.z > -25){
                        moveDirection.z +=(inputY * inputModifyFactor * airAcc * Time.deltaTime );
                        moveDirection = myTransform.TransformDirection(moveDirection);
                    }
                }
                else if (Input.GetAxis("Vertical") == 0){
                    if(moveDirection.z > 0){ 
                        moveDirection.z -= (airDecc *Time.deltaTime);
                    }
                    if(moveDirection.z < 0){ 
                        moveDirection.z += (airDecc *Time.deltaTime);
                    }
                }
            }

You haven’t included enough code for me to be sure of what you are doing in your code. But to solve your problem you will need to introduce the concept of velocity and drag to your code. Your moveDirection, once converted to world coordinates will need to be added to the velocity each frame. And each frame some drag needs to be applied so that the old velocity decays. Here is a example. Attach a character controller and this script to a game object:

#pragma strict

var maxVelocity = 3.0;
var drag = 1.0;
var speed = .2;

private var velocity = Vector3.zero;
private var cc : CharacterController;

function Start () {
	cc = GetComponent(CharacterController);
}

function Update () {
   
    var moveDirection : Vector3;
	
    moveDirection.x = Input.GetAxis("Horizontal") * speed;
    moveDirection.z = -Input.GetAxis("Vertical") * speed;
    moveDirection = transform.TransformDirection(moveDirection);
    
							// Apply drag
    velocity = Vector3.MoveTowards(velocity, Vector3.zero, drag * Time.deltaTime);
    
    velocity += moveDirection;
    
    if (velocity.magnitude > maxVelocity)
    	velocity = velocity.normalized * maxVelocity; 
	
	cc.Move(velocity * Time.deltaTime);
}

You will want to handle gravity/‘Y’ separately since you don’t want drag being applied to ‘Y’.