problem with simple character movement script

Im trying to implement a move to clicked point script in Unity 4.5, I tried to use my previous script, made in Unity 3.5, but it didnt worked. I googled a lot, but all the solutions I found dont work. This is my current version:

void Update () {
       
        if (Input.GetKeyDown(KeyCode.Mouse0)) {

            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);  
            Plane playerPlane = new Plane(Vector3.up, transform.position);
            RaycastHit hit;
            float hitdist = 0.0F;
           
            //if (Physics.Raycast(ray, out hit, 1000.0f)) {
            if (playerPlane.Raycast(ray, out hitdist)) {               
               
                Vector3 targetPoint = ray.GetPoint(hitdist);                   
                    destination = ray.GetPoint(hitdist);
                    Quaternion targetRotation = Quaternion.LookRotation(targetPoint - transform.position);
                    transform.rotation = targetRotation;

               
            }
        }
        Animation walk = GetComponent<Animation>();
        walk.Play("walk");
        transform.position = Vector3.MoveTowards(transform.position, destination, Time.deltaTime * 1.5F);
    }

The previous script moves the character, but rotates it to horizontal position, face down, and also ignores terrain collider: the character gets into the ground if there is some hill in the path. How can I solve this?

Setting the transform.position will ignore colliders. Try using rigidbody.velocity if you want it to interact with physics. I’m unsure why the rotation doesn’t work as expected - you might just have to debug it manually.

Is there any updated sample of how this should be done? I have tried to replicate my Unity 3.5 project step by step and idnt worked. also I have googled a lot, but cant find any working solution.