Create a gist now

Instantly share code, notes, and snippets.

@KRNKRS /AimFollow.cs
Last active Dec 20, 2016

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AimFollow : MonoBehaviour {
private GameObject followTarget;
private Vector3 offset;
void Awake () {
followTarget = GameObject.FindGameObjectWithTag("Player").transform.FindChild("FollowTarget").gameObject;
}
void Start()
{
offset = this.transform.position - followTarget.transform.position;
}
void Update () {
this.transform.position = followTarget.transform.position + offset;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment