Skip to content

Instantly share code, notes, and snippets.

@JoseAlba
Created November 13, 2018 15:28
Show Gist options
  • Save JoseAlba/633044eb8eafdee024214b3393e70469 to your computer and use it in GitHub Desktop.
Save JoseAlba/633044eb8eafdee024214b3393e70469 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class robotFollower : MonoBehaviour {
public int playerSpeed;
public GameObject player;
// Use this for initialization
void Start () {
//camera_offset = new Vector3(0,10,-10);
playerSpeed = 5;
player = GameObject.FindWithTag("Player");
}
void LateUpdate(){
// this.transform.position = player.transform.position;
this.transform.LookAt(player.transform);
this.transform.position += this.transform.forward * playerSpeed * Time.deltaTime;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment