topical media & game development

talk show tell print

lib-unity-tutorial-m2h-2-Assets-Game-3-Marble-game-Scripts-MarbleCamera.cs / cs



  using UnityEngine;
  using System.Collections;
  
  public class MarbleCamera : MonoBehaviour {
  
      public Transform target;
          public float relativeHeigth = 10.0f;
      public float zDistance = 5.0f;
      public float dampSpeed = 2;
  
      void Update () {
          Vector3 newPos = target.position + new Vector3(0, relativeHeigth, -zDistance);
          transform.position = Vector3.Lerp(transform.position, newPos, Time.deltaTime*dampSpeed);
          }
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.