Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Follow_Camera : MonoBehaviour
{
[SerializeField]
private Transform target;
Vector3 offset;
[SerializeField]
private float offsetX;
[SerializeField]
private float offsetY;
[SerializeField]
private float offsetZ;
void Start()
{
offset = new Vector3(target.position.x + offsetX,target.position.y+offsetY,target.position.z+offsetZ);
}
void LateUpdate()
{
offset = new Vector3(target.position.x + offsetX,target.position.y+offsetY,target.position.z+offsetZ);
transform.position = offset;
}
}
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.