Quantcast
Channel: Answers by "doomprodigy"
Viewing all articles
Browse latest Browse all 90

Answer by doomprodigy

$
0
0
What I would do as dannyskim said is move the transform position of the camera to the character. So On a script that is attached to the player add this: void Start () { mainCamera = (GameObject) GameObject.FindWithTag ("MainCamera"); } void Update () { mainCamera.transform.position = new Vector3(transform.position.x,10,transform.position.z); } And then on a script attached to the main camera add: transform.position = new Vector3(Mathf.Clamp(transform.position.x, leftLimit, rightLimit), transform.position.y, transform.position.z); In the Update somewhere, where left limit and right limit are public floats you have defined at the top of the script. Note that this is done in C# but is very easily converted to Unity Script, if you look at the documentation. Peace,

Viewing all articles
Browse latest Browse all 90

Trending Articles



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