Last active
December 20, 2016 09:20
-
-
Save KRNKRS/1a5dfdfd53c07c259f2b91d732ddf14e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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