Created
November 4, 2019 12:45
-
-
Save tubakihimeLoveHate/2d7e45849cfef03b276ea5bc45bd8d72 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 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