Skip to content

Instantly share code, notes, and snippets.

@jaizon2000
Created December 24, 2020 02:05
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 jaizon2000/042b148b7a6409b2377356ef123de2d5 to your computer and use it in GitHub Desktop.
Save jaizon2000/042b148b7a6409b2377356ef123de2d5 to your computer and use it in GitHub Desktop.
FollowScript.cs for Unity Prototype 1
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