im making an endless runner game and i want that the camera follow the player only in z axis
im using the simple "roll a ball" unity tutorial camera script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cameramove : MonoBehaviour {
public GameObject player;
private Vector3 offset;
// Use this for initialization
void Start () {
offset = transform.position - player.transform.position;
}
// Update is called once per frame
void LateUpdate () {
transform.position = player.transform.position+ offset ;
}
}
so how can i modify it to make the camera follow the player only in the z axis
and i want to ask why they are using lateupdate()
any help will be appreciated ^ ^
↧