Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SmoothFollow : MonoBehaviour {
- public Transform target; // The target we are following
- public float positionDamping;
- private Vector3 deltaPos;
- // Use this for initialization
- void Start () {
- deltaPos = new Vector3(-4f, 1f, 0f);
- }
- // Update is called once per frame
- void Update () {
- }
- public void FixedUpdate () {
- Vector3 targetPosition = target.position - (Vector3.forward * 10);
- //transform.position = Vector3.MoveTowards(transform.position, targetPosition + deltaPos, positionDamping * Time.deltaTime);
- Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, targetPosition + deltaPos, positionDamping * Time.deltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement