Im try use the Script of this post in my project(http://answers.unity3d.com/questions/29183/2d-camera-smooth-follow.html) in C#, but when i add in my project and add my Target dont happen anything, i will post the script here to see best:
**CamDown.cs**
using UnityEngine;
using System.Collections;
public class CamDown : MonoBehaviour {
public float dumptime = 0.15f;
private Vector3 velocity = Vector3.zero;
public Transform target;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (target) {
Vector3 point = Camera.main.WorldToViewportPoint(target.position);
Vector3 delta = target.position - Camera.current.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, point.z));
Vector3 destination = transform.position + delta;
transform.position = Vector3.SmoothDamp(transform.position,destination, ref velocity, dumptime);
Debug.Log ("Esta aqui");
}
}
}
in script of the post he use the camera variable, im try change to `Camera.main` and `Camera.current` but nothing happen, please help me, thanks much.
↧