Animation By character controller speed?

Hey, so i actually have two questions

One: how do i get my Blend tree to do the animations according to the players x/y speed, at the moment it just skips past the walk animation and goes strait to the run, but if i tap the “w” he walks, but no matter what i make the speed of the player it doesn’t seem to work, i also tried to change the float variable in the animator parameters but i can’t use “int”'s

using UnityEngine;
using System.Collections;

public class animation : MonoBehaviour {

    Animator anim;
   
   
    void Start ()
    {
        anim = GetComponent<Animator>();
    }
   
   
    void Update ()
    {
        float Velx = Input.GetAxis ("Vertical");
        anim.SetFloat("VelocityX", Velx);
        float Vely = Input.GetAxis ("Horizontal");
        anim.SetFloat("VelocityY", Vely);

}}

question two, i have the head bone of my player pointing towards the camera, but the head mesh goes through the camera, i was just wondering how i could parent the camera to the head bone but not let the head bone influence the rotation of the camera, (it spazzes out as if it was 4x the speed to look up and down)
or copy the x/y/z location of an empty infront of the face
using a simple code for that

 var target : Transform;
        function Update() {
transform.LookAt( target );
transform.Rotate( new Vector3(0f,0f,-90f) , Space.Self );
}

Dont worry about the second question, i was blank in the mind at the time, i just put a empty in front of the eyes and made the camera copy the position.

When you use the arrow keys, Input.GetAxis() eases into the Horizontal and Vertical axes very quickly from 0 (idle) to 1 (run). If you want more control over VelocityX and VelocityY, you can use SmoothDamp() to bring them to their target values over a longer period of time. When the character is walking, the target value should be 0.5. When the character is running, the target value should be 1.

i figured out an alternative, i made 2 seperate blend trees for the walk and run, and made them controlled by the horizontal and vertical input.getaxis, that gave me a direction, and then i made a charactor horizontal speed by velocity magnatude and put that into a speed parameter within the animator to make it blend inbetween the walk and run animations, only problem i have now is that when i press “a” the float goes to -1 and slides back to 0, but if i press “d” and let go of “a” the value drops strait from -1 to 0 so there is no time to blend between the moving left animation to the moving right animation. :l im sure ill figure it out though, here is the final bit of code

using UnityEngine;
using System.Collections;

public class animation : MonoBehaviour {
    public GameObject player;
    Animator anim;
    void Start ()
    {
        anim = GetComponent<Animator>();
    }
   

    void Update ()
    {
        CharacterController controller = player.GetComponent<CharacterController>();
        Vector3 horizontalVelocity = controller.velocity;
        horizontalVelocity = new Vector3(controller.velocity.x, 0, controller.velocity.z);
        float horizontalSpeed = horizontalVelocity.magnitude;
        float verticalSpeed = controller.velocity.y;
        float overallSpeed = controller.velocity.magnitude;

        anim.SetFloat("VelocityX", Input.GetAxis("Vertical"));
        anim.SetFloat("VelocityZ", Input.GetAxis("Horizontal"));
        anim.SetFloat("Speed", horizontalSpeed);
}}