Skip to content

Instantly share code, notes, and snippets.

@moon-goon
Created January 24, 2016 05:33
Show Gist options
  • Save moon-goon/c1e8ab5e18b2ee2fdbc9 to your computer and use it in GitHub Desktop.
Save moon-goon/c1e8ab5e18b2ee2fdbc9 to your computer and use it in GitHub Desktop.
public GameObject targetObj;
private Vector3 offsetValue;
void Start() {
offsetValue = transform.position - targetObj.transform.position;
}
void Update() {
transform.position = targetObj.transform.position + offsetValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment