Skip to content

Instantly share code, notes, and snippets.

@Templar2020
Created November 29, 2016 01:18
Show Gist options
  • Save Templar2020/d9209cab835d5bf173c5245819b3aeaf to your computer and use it in GitHub Desktop.
Save Templar2020/d9209cab835d5bf173c5245819b3aeaf to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class follow : MonoBehaviour {
public Rigidbody enemy;
public float moveSpeed;
public Transform target;
void Update(){
transform.LookAt(target);
transform.Translate(Vector3.forward*moveSpeed*Time.deltaTime);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment