Quantcast
Channel: Questions in topic: "follow"
Viewing all articles
Browse latest Browse all 536

how to make the camera follow the player only in one axis (the z axis)

$
0
0
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 ^ ^

Viewing all articles
Browse latest Browse all 536

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>