// Use this for initialization void Start() { currDestPos = patrolRoute.numOfNodes() - 1; destination = patrolRoute.nextNode(currDestPos); currDestPos = (currDestPos + 1) % patrolRoute.numOfNodes(); distToNode = 0; mode = 0; timer = 0; oldDir = destination - transform.position; transform.LookAt(destination); vc.transform.up = transform.up; vc.transform.right = transform.right; vc.transform.forward = transform.forward; vc.transform.position = transform.position + new Vector3(0, 0.1f, 0); vc.transform.rotation = transform.rotation; vc.transform.eulerAngles = transform.eulerAngles; inCone(); }