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

Character Runs Off Camera

$
0
0
Hello Unity3D i have a problem with my camera.The problem is my characters camera is auto targeting an enemy and whenever my character runs too far I can still see the enemy but i can't see the character that i have attached the camera to.What i want is no matter how far i go the camera still shows my character and the enemy.If anyone knows how i can do this.Can you please tell me how? var target : Transform; var moveSpeed = 20; var rotationSpeed = 5; var myTransform : Transform; function Awake() { myTransform = transform; } function Start() { target = GameObject.FindWithTag("Eye").transform; } function Update () { myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime); }

Viewing all articles
Browse latest Browse all 536

Latest Images

Trending Articles



Latest Images

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