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);
}
↧