Question by
Prajwal Samal · Jun 24, 2016 at 04:03 AM ·
cameracamera-movementlookatcamera followchase
Why is my camera shaking when I use my chaser script on something?
Following is my chaser script.
using UnityEngine;
using System.Collections;
class Chaser_usingTransformClass : MonoBehaviour
{
public Transform target;
Vector3 R, trans;
bool flag = true;
void Start()
{
R = new Vector3(0, 0, 0);
}
void Update()
{
trans = target.position - R;
R = target.position;
gameObject.transform.LookAt(target, Vector3.up);
if (flag)
{
gameObject.transform.Translate(new Vector3(0, 0, 0), Space.World);
flag = false;
}
else
gameObject.transform.Translate(trans, Space.World);
}
}
Comment