Created
December 24, 2020 02:05
-
-
Save jaizon2000/042b148b7a6409b2377356ef123de2d5 to your computer and use it in GitHub Desktop.
FollowScript.cs for Unity Prototype 1
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 FollowScript : MonoBehaviour | |
{ | |
public GameObject player; | |
public Vector3 CurrentCameraPos; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
CurrentCameraPos = transform.position; | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
// Camera follows vehicle | |
transform.position = player.transform.position + CurrentCameraPos; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment