y rotation not having effect on character controlller.Move()

Hello,

I made a movement script that uses a Character Controller. However, the Y rotation on the GameObject is not making the Character Controller move in the direction the transform is pointing. Here is the script I am using:

        Vector3 moveVector = Vector3.zero;
        moveVector.x = Input.GetAxisRaw("Horizontal") * speed * Time.deltaTime;
        moveVector.y = upVelocity;
        moveVector.z = Input.GetAxisRaw("Vertical") * speed * Time.deltaTime;

        c.Move(moveVector);
        transform.Rotate(0,Input.GetAxisRaw("Mouse X") * sensitivity,0);
        cam.transform.Rotate(new Vector3(-Input.GetAxisRaw("Mouse Y") * sensitivity, 0, 0));

Try this to calculate your moveVector:

Vector3 move = (transform.forward * Input.GetAxisRaw("Vertical") * speed) + (transform.right * Input.GetAxisRaw("Horizontal") * speed);
move *= Time.deltaTime;

This takes the direction your gameObject is currently facing into account.