using System.Collections; using System.Collections.Generic; using UnityEngine; public class SpawnFollow : MonoBehaviour { //SpawnGB public GameObject gbPlayer; public GameObject[] pfPlayers; public Transform spawnPoint; public int iPlayer; // Follow //public GameObject objTarget; public Vector3 v3Pos; public int iSmooth = 1; // Use this for initialization void Start () { //iPlayer = PlayerPrefs.GetInt("PlayerSelected"); gbPlayer = Instantiate(pfPlayers[iPlayer], spawnPoint.position, spawnPoint.rotation); } // Update is called once per frame void Update () { transform.position = gbPlayer.transform.position + v3Pos.z * gbPlayer.transform.forward + new Vector3(0, 1, 0) * v3Pos.y; transform.rotation = Quaternion.Lerp(transform.rotation, gbPlayer.transform.rotation, Time.deltaTime * iSmooth); } }