Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FollowTarget : MonoBehaviour
[SerializeField] private Transform target;
void Update()
var diff = target.position - transform.position;
transform.rotation = Quaternion.LookRotation(diff, Vector3.up);
transform.position += diff.normalized * Time.deltaTime;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.