Camera moves into Object instead of following

hi there,

I got the following code: It's my camera class, following an object, ignoring the y-Rotation, ideal for a game that just follows one direction, like mine. Now, the "Distance" gets smaller, that means the camera moves into the object, and I have absolutely not idea why it does that.

using UnityEngine;

using System.Collections;

public class StaticCamera : MonoBehaviour

{

    public Transform Sph;

    public Vector3 pSph;

    public float height = 10f;

    public float distance = 10f;

    public float Dampening = 1f;

    void LateUpdate()

    {

        pSph = Sph.position;

        float desHeight = pSph.y + height;

        float curHeight = transform.position.y;

        curHeight = Mathf.Lerp(curHeight, desHeight, Time.deltaTime *Dampening);

        transform.position = pSph;

        transform.position -= Vector3.forward * distance;

        transform.position += new Vector3(0,desHeight,0);

        //transform.Translate(0,curHeight*Time.deltaTime,0);

        /*

         * float desX = Mathf.Lerp(transform.position.x, Sph.position.x,Dampening*Time.deltaTime);

        float desZ = Mathf.Lerp(transform.position.z, Sph.position.z,Dampening*Time.deltaTime);

        transform.position = new Vector3(desX,0f+15f,desZ);

        */

        //Quaternion rtn = Quaternion.Euler(15,0,15);

        //transform.rotation = Quaternion.Slerp(gameObject.transform.rotation, rtn, Time.deltaTime*10);

        transform.LookAt(Sph);

        Debug.Log("Distance: " + Vector3.Distance(gameObject.transform.position, Sph.position));

    }

}

Goch, found the problem. Even though height, etc. were set inside the script the editor had overwritten it to zero =) This explains a lot of "bugs" to me now. Man, I was totally broken, because Vector3.up * height (=10f) returned (0,0,0).