Skip to content

Instantly share code, notes, and snippets.

@tubakihimeLoveHate
Created November 4, 2019 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tubakihimeLoveHate/2d7e45849cfef03b276ea5bc45bd8d72 to your computer and use it in GitHub Desktop.
Save tubakihimeLoveHate/2d7e45849cfef03b276ea5bc45bd8d72 to your computer and use it in GitHub Desktop.
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