I WANT Jumping while moving

This is a two part question with the script i was trying to make work.

How do I get the jump to allow me to jump over an obstacle and still move forward? I figured out how to get the step level being in the character controller. But the jump just jumps up in a statick location.

Here is the code I was working on. Not sure if i put something in the wrong place or not.

using UnityEngine;
using System.Collections;

public class PlayerControl : MonoBehaviour {

    //Variables
    public float speed = 3.0F;
    public float rotateSpeed = 3.0F;
    public float jumpSpeed = 8.0F;
    public float gravity = 20.0F;
    private Vector3 moveDirection = Vector3.zero;
    
    void Update()
    {
        CharacterController controller = GetComponent<CharacterController>();
        // is the controller on the ground?
        if (controller.isGrounded)
        {
            //Feed moveDirection with input.
            transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, 0);
            Vector3 forward = transform.TransformDirection(Vector3.forward);
            float curSpeed = speed * Input.GetAxis("Vertical");
            controller.SimpleMove(forward * curSpeed);
            //Jumping
            if (Input.GetButton("Jump"))
                moveDirection.y = jumpSpeed;

        }
        //Applying gravity to the controller
        moveDirection.y -= gravity * Time.deltaTime;
        //Making the character move
        controller.Move(moveDirection * Time.deltaTime);
    }
}

My previous one without jump was like this but the test character passed through objects regardless if it had a rigid body or not. Excuse how ugly it is since i am a very slow learner.

{

    public float moveSpeed= 15.0f;
    public float turnSpeed = 100.0f;

    // Use this for initialization
    void Start()
    {
        moveSpeed = 15.0f;
        turnSpeed = 100.0f;
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetKey(KeyCode.UpArrow))
        transform.Translate(Vector3.forward*moveSpeed*Time.deltaTime);
        if (Input.GetKey(KeyCode.DownArrow))
        transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);
        if (Input.GetKey(KeyCode.LeftArrow))
        transform.Rotate(Vector3.up * -turnSpeed * Time.deltaTime);
        if (Input.GetKey(KeyCode.RightArrow))
        transform.Rotate(Vector3.up * turnSpeed * Time.deltaTime);
    }
}

I will figure out how to call animations later.

You move forward if you are on the ground, because controller.isGrounded is true.

             if (controller.isGrounded)
             {
                 //Feed moveDirection with input.
                 transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, 0);
                 Vector3 forward = transform.TransformDirection(Vector3.forward);
                 float curSpeed = speed * Input.GetAxis("Vertical");
                 controller.SimpleMove(forward * curSpeed);
                 //Jumping
                 if (Input.GetButton("Jump"))
                     moveDirection.y = jumpSpeed;
             }

If you always want to move, even when jumping then modify your code so that it will work under both conditions, i.e.:

         if (controller.isGrounded)
         {
                    //code that works when on the ground
                    //...
         }
         //Move when on the ground or in the air!
         float curSpeed = speed * Input.GetAxis("Vertical");
         controller.SimpleMove(forward * curSpeed);

         //more code that works when in the air or on the ground
     }

If I just have this

moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
            moveDirection = transform.TransformDirection(moveDirection);
            moveDirection *= speed;

I cannot Rotate and just move side to side and then the jump function works right.

If I just add the rotate string:

transform.Rotate(0, Input.GetAxis(“Horizontal”) * rotateSpeed, 0);

to the:

moveDirection = new Vector3(Input.GetAxis(“Horizontal”), 0, Input.GetAxis(“Vertical”));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;

I get a stupid affect where the damn thing rotates wide instead of just in place. If I try the code string like:

transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, 0, Input.GetAxis("Vertical"));

The end part with the Input,GetAxis(“Verticle”) reads as an error and I get no "solitions to call the verticle movement for forward/backward, with the rotation horizontal on the y axis.

This line of code also does not work either

 transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, y, moveDirection = new Vector3.z, Input.GetAxis("Vertical");

If I try it this way the wide turning on a rotation is even more rediculous:

moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
            moveDirection = transform.TransformDirection(moveDirection);
            moveDirection *= speed;
            if (Input.GetKey(KeyCode.LeftArrow))
                    transform.Rotate(Vector3.up * -rotateSpeed * Time.deltaTime);
           if (Input.GetKey(KeyCode.RightArrow))
                    transform.Rotate(Vector3.up * rotateSpeed * Time.deltaTime);

And of course the jump function n all of these idiotic set ups still works correctly like I want it too but everything else goes to crap.

So when i do get the Movement and Rotation working with this

Vector3 forward = transform.TransformDirection(Vector3.forward);
            float curSpeed = speed * Input.GetAxis("Vertical");
            transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, 0);
            controller.SimpleMove(forward * curSpeed);

Then the jump function becomes worthless jumping in place!!!

I need to KNOW WHY when i add the Rotation Feature that IS NEEDED the JUMPING FEATURE FAILS to FUNCTION!!!