using UnityEngine;
using System.Collections;
public class FolloePlayer : MonoBehaviour {
private Vector3 offset;
public Transform trsPlay;
void Awake () {
offset = transform.position - trsPlay.position;
offset = new Vector3(0, offset.y,offset.z);
}
void Update () {
print(transform.position);
print(trsPlay.position);
this.transform.position = trsPlay.position + offset;
}
}
using System.Collections;
public class FolloePlayer : MonoBehaviour {
private Vector3 offset;
public Transform trsPlay;
void Awake () {
offset = transform.position - trsPlay.position;
offset = new Vector3(0, offset.y,offset.z);
}
void Update () {
print(transform.position);
print(trsPlay.position);
this.transform.position = trsPlay.position + offset;
}
}