[JavaScript] 3D movement not going well...

As you can tell, my movement script isn’t working to well, I need a bit of help with this, I am currently using a box collider to keep it upright, as you can clearly see - it’s not working.

I need a few tips to getting this right, I’ve never been good with movement.

My code;

#pragma strict

var anim : Animation;

var moveSpeed : int;
var jumpHeight : int;
var gravity : int;
private var curSpeed : float;
private var cont : CharacterController;
private var moveDir : Vector3;

function Start()
    {
        curSpeed = moveSpeed;
        cont = gameObject.GetComponent(CharacterController);
    }

function Update ()
    {

        anim = GetComponent.<Animation>();
       
        moveDir = Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
        moveDir = transform.TransformDirection(moveDir);
        moveDir *= curSpeed;
               
        if(Input.GetButtonDown("Jump"))
            {
                moveDir.y = jumpHeight;
            }

        cont.Move(moveDir * Time.deltaTime);
        moveDir.y -= gravity * Time.deltaTime;
    }

I appreciate any help that you give! Thanks (:

It’s hard to tell what’s happening in the gif. It looks like your mouse look script is flipping over on itself and then really bad things start happening. Or is all of that happening from just this one script?

Also, why are you using a box collider if you’re using a character controller? The character controller should be all you need as it creates a capsule around your character.

To answer your second question. I haven’t used this program in a while! Also, I’m not sure why, but when I select my human model, the movement axis are way way away. I don’t know why ;'(.

Also, it’s one single script for movement.